mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-24 22:45:41 +01:00
Randomize the order of addr processing
This commit is contained in:
@@ -2804,6 +2804,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
peer->m_addr_token_timestamp = current_time;
|
||||
|
||||
const bool rate_limited = !pfrom.HasPermission(NetPermissionFlags::Addr);
|
||||
Shuffle(vAddr.begin(), vAddr.end(), FastRandomContext());
|
||||
for (CAddress& addr : vAddr)
|
||||
{
|
||||
if (interruptMsgProc)
|
||||
|
||||
@@ -42,7 +42,9 @@ class AddrReceiver(P2PInterface):
|
||||
super().__init__(support_addrv2 = True)
|
||||
|
||||
def on_addrv2(self, message):
|
||||
if ADDRS == message.addrs:
|
||||
expected_set = set((addr.ip, addr.port) for addr in ADDRS)
|
||||
received_set = set((addr.ip, addr.port) for addr in message.addrs)
|
||||
if expected_set == received_set:
|
||||
self.addrv2_received_and_checked = True
|
||||
|
||||
def wait_for_addrv2(self):
|
||||
|
||||
Reference in New Issue
Block a user