Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-pubsub
Commits
4c804a95
Commit
4c804a95
authored
Jan 22, 2020
by
Yusef Napora
Committed by
vyzo
Apr 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
track changes to peer records in -core
parent
5c48ff9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
gossipsub.go
gossipsub.go
+4
-3
No files found.
gossipsub.go
View file @
4c804a95
...
@@ -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
.
Warn
ing
f
(
"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
.
Warn
ing
f
(
"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
.
Warn
ing
f
(
"bogus peer record obtained through px: peer ID %s doesn't match expected peer %s"
,
rec
.
PeerID
,
p
)
continue
continue
}
}
spr
=
envelope
spr
=
envelope
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment