@@ -138,9 +138,9 @@ static const int MAX_UNCONNECTING_HEADERS = 10;
138138static const unsigned int NODE_NETWORK_LIMITED_MIN_BLOCKS = 288 ;
139139
140140/* * Average delay between local address broadcasts in seconds. */
141- static constexpr unsigned int AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL = 24 * 60 * 60 ;
141+ static constexpr std::chrono::hours AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL{ 24 } ;
142142/* * Average delay between peer address broadcasts in seconds. */
143- static const unsigned int AVG_ADDRESS_BROADCAST_INTERVAL = 30 ;
143+ static constexpr std::chrono::seconds AVG_ADDRESS_BROADCAST_INTERVAL{ 30 } ;
144144/* * Average delay between trickled inventory transmissions in seconds.
145145 * Blocks and peers with noban permission bypass this, regular outbound peers get half this delay,
146146 * Masternode outbound peers get quarter this delay. */
@@ -1889,13 +1889,13 @@ void RelayTransaction(const uint256& txid, const CConnman& connman)
18891889 });
18901890}
18911891
1892- static void RelayAddress (const CAddress& addr, bool fReachable , CConnman& connman)
1892+ static void RelayAddress (const CAddress& addr, bool fReachable , const CConnman& connman)
18931893{
18941894 // Relay to a limited number of other nodes
18951895 // Use deterministic randomness to send to the same nodes for 24 hours
18961896 // at a time so the m_addr_knowns of the chosen nodes prevent repeats
18971897 uint64_t hashAddr = addr.GetHash ();
1898- const CSipHasher hasher = connman.GetDeterministicRandomizer (RANDOMIZER_ID_ADDRESS_RELAY).Write (hashAddr << 32 ).Write ((GetTime () + hashAddr) / (24 * 60 * 60 ));
1898+ const CSipHasher hasher = connman.GetDeterministicRandomizer (RANDOMIZER_ID_ADDRESS_RELAY).Write (hashAddr << 32 ).Write ((GetTime () + hashAddr) / (24 * 60 * 60 ));
18991899 FastRandomContext insecure_rand;
19001900
19011901 // Relay reachable addresses to 2 peers. Unreachable addresses are relayed randomly to 1 or 2 peers.
@@ -4678,16 +4678,16 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
46784678 int64_t nNow = GetTimeMicros ();
46794679 auto current_time = GetTime<std::chrono::microseconds>();
46804680
4681- if (pto->IsAddrRelayPeer () && !m_chainman.ActiveChainstate ().IsInitialBlockDownload () && pto->nNextLocalAddrSend < nNow ) {
4681+ if (pto->IsAddrRelayPeer () && !m_chainman.ActiveChainstate ().IsInitialBlockDownload () && pto->m_next_local_addr_send < current_time ) {
46824682 AdvertiseLocal (pto);
4683- pto->nNextLocalAddrSend = PoissonNextSend (nNow , AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
4683+ pto->m_next_local_addr_send = PoissonNextSend (current_time , AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
46844684 }
46854685
46864686 //
46874687 // Message: addr
46884688 //
4689- if (pto->IsAddrRelayPeer () && pto->nNextAddrSend < nNow ) {
4690- pto->nNextAddrSend = PoissonNextSend (nNow , AVG_ADDRESS_BROADCAST_INTERVAL);
4689+ if (pto->IsAddrRelayPeer () && pto->m_next_addr_send < current_time ) {
4690+ pto->m_next_addr_send = PoissonNextSend (current_time , AVG_ADDRESS_BROADCAST_INTERVAL);
46914691 std::vector<CAddress> vAddr;
46924692 vAddr.reserve (pto->vAddrToSend .size ());
46934693
0 commit comments