@@ -1022,7 +1022,7 @@ class PeerManagerImpl final : public PeerManager
1022
1022
bool SetupAddressRelay (const CNode& node, Peer& peer) EXCLUSIVE_LOCKS_REQUIRED(g_msgproc_mutex);
1023
1023
1024
1024
void AddAddressKnown (Peer& peer, const CAddress& addr) EXCLUSIVE_LOCKS_REQUIRED(g_msgproc_mutex);
1025
- void PushAddress (Peer& peer, const CAddress& addr, FastRandomContext& insecure_rand ) EXCLUSIVE_LOCKS_REQUIRED(g_msgproc_mutex);
1025
+ void PushAddress (Peer& peer, const CAddress& addr) EXCLUSIVE_LOCKS_REQUIRED(g_msgproc_mutex);
1026
1026
};
1027
1027
1028
1028
const CNodeState* PeerManagerImpl::State (NodeId pnode) const EXCLUSIVE_LOCKS_REQUIRED(cs_main)
@@ -1054,15 +1054,15 @@ void PeerManagerImpl::AddAddressKnown(Peer& peer, const CAddress& addr)
1054
1054
peer.m_addr_known ->insert (addr.GetKey ());
1055
1055
}
1056
1056
1057
- void PeerManagerImpl::PushAddress (Peer& peer, const CAddress& addr, FastRandomContext& insecure_rand )
1057
+ void PeerManagerImpl::PushAddress (Peer& peer, const CAddress& addr)
1058
1058
{
1059
1059
// Known checking here is only to save space from duplicates.
1060
1060
// Before sending, we'll filter it again for known addresses that were
1061
1061
// added after addresses were pushed.
1062
1062
assert (peer.m_addr_known );
1063
1063
if (addr.IsValid () && !peer.m_addr_known ->contains (addr.GetKey ()) && IsAddrCompatible (peer, addr)) {
1064
1064
if (peer.m_addrs_to_send .size () >= MAX_ADDR_TO_SEND) {
1065
- peer.m_addrs_to_send [insecure_rand .randrange (peer.m_addrs_to_send .size ())] = addr;
1065
+ peer.m_addrs_to_send [m_rng .randrange (peer.m_addrs_to_send .size ())] = addr;
1066
1066
} else {
1067
1067
peer.m_addrs_to_send .push_back (addr);
1068
1068
}
@@ -2108,7 +2108,6 @@ void PeerManagerImpl::RelayAddress(NodeId originator,
2108
2108
const CSipHasher hasher{m_connman.GetDeterministicRandomizer (RANDOMIZER_ID_ADDRESS_RELAY)
2109
2109
.Write (hash_addr)
2110
2110
.Write (time_addr)};
2111
- FastRandomContext insecure_rand;
2112
2111
2113
2112
// Relay reachable addresses to 2 peers. Unreachable addresses are relayed randomly to 1 or 2 peers.
2114
2113
unsigned int nRelayNodes = (fReachable || (hasher.Finalize () & 1 )) ? 2 : 1 ;
@@ -2132,7 +2131,7 @@ void PeerManagerImpl::RelayAddress(NodeId originator,
2132
2131
};
2133
2132
2134
2133
for (unsigned int i = 0 ; i < nRelayNodes && best[i].first != 0 ; i++) {
2135
- PushAddress (*best[i].second , addr, insecure_rand );
2134
+ PushAddress (*best[i].second , addr);
2136
2135
}
2137
2136
}
2138
2137
@@ -4657,9 +4656,8 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4657
4656
} else {
4658
4657
vAddr = m_connman.GetAddresses (pfrom, MAX_ADDR_TO_SEND, MAX_PCT_ADDR_TO_SEND);
4659
4658
}
4660
- FastRandomContext insecure_rand;
4661
4659
for (const CAddress &addr : vAddr) {
4662
- PushAddress (*peer, addr, insecure_rand );
4660
+ PushAddress (*peer, addr);
4663
4661
}
4664
4662
return ;
4665
4663
}
@@ -5261,8 +5259,7 @@ void PeerManagerImpl::MaybeSendAddr(CNode& node, Peer& peer, std::chrono::micros
5261
5259
}
5262
5260
if (std::optional<CService> local_service = GetLocalAddrForPeer (node)) {
5263
5261
CAddress local_addr{*local_service, peer.m_our_services , Now<NodeSeconds>()};
5264
- FastRandomContext insecure_rand;
5265
- PushAddress (peer, local_addr, insecure_rand);
5262
+ PushAddress (peer, local_addr);
5266
5263
}
5267
5264
peer.m_next_local_addr_send = GetExponentialRand (current_time, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
5268
5265
}
0 commit comments