Commit dd1093f4 authored by Steven Allen's avatar Steven Allen Committed by Adin Schmahmann

fix: use connect instead of findpeer so we ensure we actually connect

Otherwise, the ID is going to be incorrect.

Note: technically, the previous logic didn't need to connect to the target peer
to complete. However, I'm fine dropping that capability in favor of more
up-to-date information.
parent 7565da9b
......@@ -97,15 +97,17 @@ EXAMPLE:
return errors.New(offlineIdErrorMessage)
}
p, err := n.Routing.FindPeer(req.Context, id)
if err == kb.ErrLookupFailure {
// We need to actually connect to run identify.
err = n.PeerHost.Connect(req.Context, peer.AddrInfo{ID: id})
switch err {
case nil:
case kb.ErrLookupFailure:
return errors.New(offlineIdErrorMessage)
}
if err != nil {
default:
return err
}
output, err := printPeer(n.Peerstore, p.ID)
output, err := printPeer(n.Peerstore, id)
if err != nil {
return err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment