Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve peer hints for pin remote add #8143

Merged
merged 4 commits into from
Jun 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions core/commands/pin/remotepin.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,19 @@ NOTE: a comma-separated notation is supported in CLI for convenience:
}

// Prepare Pin.origins
// Add own multiaddrs to the 'origins' array, so Pinning Service can
// use that as a hint and connect back to us (if possible)
// If CID in blockstore, add own multiaddrs to the 'origins' array
// so pinning service can use that as a hint and connect back to us.
node, err := cmdenv.GetNode(env)
if err != nil {
return err
}
if node.PeerHost != nil {

isInBlockstore, err := node.Blockstore.Has(rp.Cid())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lidel this seems fine. I don't think we're introducing any new problems on the CoreAPI/Node boundary, but wanted to double check. WDYT?

The boundary issues we generally run into are that IIRC accessing the node directly doesn't respect the --offline flag, however I think we may already have that issue given that we use node.PeerHost below.

if err != nil {
return err
}

if isInBlockstore && node.PeerHost != nil {
addrs, err := peer.AddrInfoToP2pAddrs(host.InfoFromHost(node.PeerHost))
if err != nil {
return err
Expand Down