From 2e46fe023bfa918c5e4b820decc255600341c9d3 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 26d4066fc..e431efb88 100644 --- a/internal/p2p/peermanager.go +++ b/internal/p2p/peermanager.go @@ -989,6 +989,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-- + } } } }