-
Notifications
You must be signed in to change notification settings - Fork 190
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
Update peer-exchange branch with PeerRecord api changes #257
Conversation
gossipsub.go
Outdated
@@ -3,6 +3,7 @@ package pubsub | |||
import ( | |||
"context" | |||
"fmt" | |||
"github.com/libp2p/go-libp2p-core/record" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put this together with our other imports? Here it is mixed with system imports.
gossipsub.go
Outdated
@@ -820,21 +828,24 @@ func (gs *GossipSubRouter) makePrune(p peer.ID, topic string) *pb.ControlPrune { | |||
return p != xp | |||
}) | |||
|
|||
cab, peerstoreSupportsSignedAddrs := peerstore.GetCertifiedAddrBook(gs.p.host.Peerstore()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we call the variable something shorter? This is an eyesore.
gossipsub.go
Outdated
rec, ok := r.(*peer.PeerRecord) | ||
if !ok { | ||
log.Warnf("bogus routing record obtained through px: envelope payload is not PeerRecord") | ||
} | ||
if rec.PeerID != p { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a control flow issue here; if !ok
then rec.PeerID
is a nil pointer dereference, which could crash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for catching that 👍
Hey @vyzo, this PR is based on the branch for #234 and just updates it to work with the various name changes that have happened to the signed peer records PR (libp2p/go-libp2p-core#73).
let me know if you have any questions & also feel free to comment on the -core PR if you think we need to change the API at all before merge.