Randomize the order of addr processing
This commit is contained in:
1 parent
0d64b8f709
commit
5648138f59
2 files changed
+4
-1
No files matched your search
@@ -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