Commit 4c804a95 authored by Yusef Napora's avatar Yusef Napora Committed by vyzo

track changes to peer records in -core

parent 5c48ff9a
...@@ -3,6 +3,7 @@ package pubsub ...@@ -3,6 +3,7 @@ package pubsub
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/libp2p/go-libp2p-core/record"
"math/rand" "math/rand"
"time" "time"
...@@ -311,16 +312,16 @@ func (gs *GossipSubRouter) pxConnect(peers []*pb.PeerInfo) { ...@@ -311,16 +312,16 @@ func (gs *GossipSubRouter) pxConnect(peers []*pb.PeerInfo) {
// the peer sent us a signed record; ensure that it is valid // the peer sent us a signed record; ensure that it is valid
envelope, r, err := record.ConsumeEnvelope(pi.SignedPeerRecord, peer.PeerRecordEnvelopeDomain) envelope, r, err := record.ConsumeEnvelope(pi.SignedPeerRecord, peer.PeerRecordEnvelopeDomain)
if err != nil { if err != nil {
log.Warnf("error unmarshalling peer record obtained through px: %s", err) log.Warningf("error unmarshalling peer record obtained through px: %s", err)
continue continue
} }
rec, ok := r.(*peer.PeerRecord) rec, ok := r.(*peer.PeerRecord)
if !ok { if !ok {
log.Warnf("bogus peer record obtained through px: envelope payload is not PeerRecord") log.Warningf("bogus peer record obtained through px: envelope payload is not PeerRecord")
continue continue
} }
if rec.PeerID != p { if rec.PeerID != p {
log.Warnf("bogus peer record obtained through px: peer ID %s doesn't match expected peer %s", rec.PeerID, p) log.Warningf("bogus peer record obtained through px: peer ID %s doesn't match expected peer %s", rec.PeerID, p)
continue continue
} }
spr = envelope spr = envelope
......
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