Skip to content

Commit 544c412

Browse files
committed
identify: only store _reported_ multiaddrs
We still tell the remote host about the observed addr but we don't store it. That way, we give them a chance to decide if they want to actually use and advertise it. Ideally, we'd distinguish between local information and signed routing information but we don't do that yet. This should reduce the address explosion issue where peers learn about multiple (bad) observed addresses for the same peer. It should also give peers more control over how they can be dialed.
1 parent 28eb467 commit 544c412

File tree

1 file changed

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

1 file changed

+2
-5
lines changed

p2p/protocol/identify/id.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,8 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) {
238238
lmaddrs = append(lmaddrs, maddr)
239239
}
240240

241-
// if the address reported by the connection roughly matches their annoucned
242-
// listener addresses, its likely to be an external NAT address
243-
if HasConsistentTransport(c.RemoteMultiaddr(), lmaddrs) {
244-
lmaddrs = append(lmaddrs, c.RemoteMultiaddr())
245-
}
241+
// NOTE: Do not add `c.RemoteMultiaddr()` to the peerstore if the remote
242+
// peer doesn't tell us to do so. Otherwise, we'll advertise it.
246243

247244
// Extend the TTLs on the known (probably) good addresses.
248245
// Taking the lock ensures that we don't concurrently process a disconnect.

0 commit comments

Comments
 (0)