Skip to content

Commit

Permalink
Improve peer hints for pin remote add (#8143)
Browse files Browse the repository at this point in the history
* improve peer hints in pin.origins
  • Loading branch information
brianstrauch authored Jun 25, 2021
1 parent d48d035 commit 5ad0417
Showing 1 changed file with 9 additions and 3 deletions.
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())
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

0 comments on commit 5ad0417

Please sign in to comment.