Skip to content

Commit 795d1f2

Browse files
sipahebasto
authored andcommitted
Randomize the order of addr processing
1 parent 8fcb30f commit 795d1f2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/net_processing.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2804,6 +2804,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
28042804
peer->m_addr_token_timestamp = current_time;
28052805

28062806
const bool rate_limited = !pfrom.HasPermission(NetPermissionFlags::Addr);
2807+
Shuffle(vAddr.begin(), vAddr.end(), FastRandomContext());
28072808
for (CAddress& addr : vAddr)
28082809
{
28092810
if (interruptMsgProc)

test/functional/p2p_addrv2_relay.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def __init__(self):
4242
super().__init__(support_addrv2 = True)
4343

4444
def on_addrv2(self, message):
45-
if ADDRS == message.addrs:
45+
expected_set = set((addr.ip, addr.port) for addr in ADDRS)
46+
received_set = set((addr.ip, addr.port) for addr in message.addrs)
47+
if expected_set == received_set:
4648
self.addrv2_received_and_checked = True
4749

4850
def wait_for_addrv2(self):

0 commit comments

Comments
 (0)