From a3f7daf65f8e95af8aa625ae78f223f5c2a963ea Mon Sep 17 00:00:00 2001 From: tycho garen Date: Thu, 16 Jun 2022 18:23:10 -0400 Subject: [PATCH] dec limit --- internal/p2p/peermanager.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/p2p/peermanager.go b/internal/p2p/peermanager.go index 1d83b5267..93a19494e 100644 --- a/internal/p2p/peermanager.go +++ b/internal/p2p/peermanager.go @@ -1012,6 +1012,14 @@ func (m *PeerManager) Advertise(peerID types.NodeID, limit uint16) []NodeAddress } } else { seenAddresses[addressInfo.Address] = struct{}{} + // if the number of addresses + // is the same as the limit, + // we should remove private + // addresses from the limit so + // we can still return early. + if numAddresses == int(limit) { + limit-- + } } } }