mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
Randomize the order of addr processing
This commit is contained in:
parent
0d64b8f709
commit
5648138f59
2 changed files with 4 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue