@@ -1244,7 +1244,7 @@ std::chrono::microseconds PeerManagerImpl::NextInvToInbounds(std::chrono::micros
12441244 // If this function were called from multiple threads simultaneously
12451245 // it would possible that both update the next send variable, and return a different result to their caller.
12461246 // This is not possible in practice as only the net processing thread invokes this function.
1247- m_next_inv_to_inbounds = GetExponentialRand ( now, average_interval);
1247+ m_next_inv_to_inbounds = now + FastRandomContext (). rand_exp_duration ( average_interval);
12481248 }
12491249 return m_next_inv_to_inbounds;
12501250}
@@ -5654,13 +5654,13 @@ void PeerManagerImpl::MaybeSendAddr(CNode& node, Peer& peer, std::chrono::micros
56545654 CAddress local_addr{*local_service, peer.m_our_services , Now<NodeSeconds>()};
56555655 PushAddress (peer, local_addr);
56565656 }
5657- peer.m_next_local_addr_send = GetExponentialRand ( current_time, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
5657+ peer.m_next_local_addr_send = current_time + FastRandomContext (). rand_exp_duration ( AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
56585658 }
56595659
56605660 // We sent an `addr` message to this peer recently. Nothing more to do.
56615661 if (current_time <= peer.m_next_addr_send ) return ;
56625662
5663- peer.m_next_addr_send = GetExponentialRand ( current_time, AVG_ADDRESS_BROADCAST_INTERVAL);
5663+ peer.m_next_addr_send = current_time + FastRandomContext (). rand_exp_duration ( AVG_ADDRESS_BROADCAST_INTERVAL);
56645664
56655665 if (!Assume (peer.m_addrs_to_send .size () <= MAX_ADDR_TO_SEND)) {
56665666 // Should be impossible since we always check size before adding to
@@ -5747,7 +5747,7 @@ void PeerManagerImpl::MaybeSendFeefilter(CNode& pto, Peer& peer, std::chrono::mi
57475747 MakeAndPushMessage (pto, NetMsgType::FEEFILTER, filterToSend);
57485748 peer.m_fee_filter_sent = filterToSend;
57495749 }
5750- peer.m_next_send_feefilter = GetExponentialRand ( current_time, AVG_FEEFILTER_BROADCAST_INTERVAL);
5750+ peer.m_next_send_feefilter = current_time + FastRandomContext (). rand_exp_duration ( AVG_FEEFILTER_BROADCAST_INTERVAL);
57515751 }
57525752 // If the fee filter has changed substantially and it's still more than MAX_FEEFILTER_CHANGE_DELAY
57535753 // until scheduled broadcast, then move the broadcast to within MAX_FEEFILTER_CHANGE_DELAY.
@@ -6059,7 +6059,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
60596059 if (pto->IsInboundConn ()) {
60606060 tx_relay->m_next_inv_send_time = NextInvToInbounds (current_time, INBOUND_INVENTORY_BROADCAST_INTERVAL);
60616061 } else {
6062- tx_relay->m_next_inv_send_time = GetExponentialRand ( current_time, OUTBOUND_INVENTORY_BROADCAST_INTERVAL);
6062+ tx_relay->m_next_inv_send_time = current_time + FastRandomContext (). rand_exp_duration ( OUTBOUND_INVENTORY_BROADCAST_INTERVAL);
60636063 }
60646064 }
60656065
0 commit comments