Skip to content

Commit 679c214

Browse files
committed
identify: only record observed addresses that match an address we're announcing
This is should prevent us from, e.g., announcing relay addresses _just_ because a peer tells us we're reachable through a relay.
1 parent 544c412 commit 679c214

File tree

1 file changed

+5
-0
lines changed
  • p2p/protocol/identify

1 file changed

+5
-0
lines changed

p2p/protocol/identify/id.go

+5
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,11 @@ func (ids *IDService) consumeObservedAddress(observed []byte, c inet.Conn) {
409409
return
410410
}
411411

412+
if !HasConsistentTransport(c.RemoteMultiaddr(), ids.Host.Addrs()) {
413+
log.Debugf("ignoring observed multiaddr that doesn't match the transports of any addresses we're announcing", c.RemoteMultiaddr())
414+
return
415+
}
416+
412417
log.Debugf("identify identifying observed multiaddr: %s %s", c.LocalMultiaddr(), ifaceaddrs)
413418
if !addrInAddrs(c.LocalMultiaddr(), ifaceaddrs) && !addrInAddrs(c.LocalMultiaddr(), ids.Host.Network().ListenAddresses()) {
414419
// not in our list

0 commit comments

Comments
 (0)