@@ -936,7 +936,7 @@ class PeerManagerImpl final : public PeerManager
936
936
* accurately determine when we received the transaction (and potentially
937
937
* determine the transaction's origin). */
938
938
std::chrono::microseconds NextInvToInbounds (std::chrono::microseconds now,
939
- std::chrono::seconds average_interval);
939
+ std::chrono::seconds average_interval) EXCLUSIVE_LOCKS_REQUIRED(g_msgproc_mutex) ;
940
940
941
941
942
942
// All of the following cache a recent block, and are protected by m_most_recent_block_mutex
@@ -1244,7 +1244,7 @@ std::chrono::microseconds PeerManagerImpl::NextInvToInbounds(std::chrono::micros
1244
1244
// If this function were called from multiple threads simultaneously
1245
1245
// it would possible that both update the next send variable, and return a different result to their caller.
1246
1246
// This is not possible in practice as only the net processing thread invokes this function.
1247
- m_next_inv_to_inbounds = now + FastRandomContext () .rand_exp_duration (average_interval);
1247
+ m_next_inv_to_inbounds = now + m_rng .rand_exp_duration (average_interval);
1248
1248
}
1249
1249
return m_next_inv_to_inbounds;
1250
1250
}
@@ -5654,13 +5654,13 @@ void PeerManagerImpl::MaybeSendAddr(CNode& node, Peer& peer, std::chrono::micros
5654
5654
CAddress local_addr{*local_service, peer.m_our_services , Now<NodeSeconds>()};
5655
5655
PushAddress (peer, local_addr);
5656
5656
}
5657
- peer.m_next_local_addr_send = current_time + FastRandomContext () .rand_exp_duration (AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
5657
+ peer.m_next_local_addr_send = current_time + m_rng .rand_exp_duration (AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
5658
5658
}
5659
5659
5660
5660
// We sent an `addr` message to this peer recently. Nothing more to do.
5661
5661
if (current_time <= peer.m_next_addr_send ) return ;
5662
5662
5663
- peer.m_next_addr_send = current_time + FastRandomContext () .rand_exp_duration (AVG_ADDRESS_BROADCAST_INTERVAL);
5663
+ peer.m_next_addr_send = current_time + m_rng .rand_exp_duration (AVG_ADDRESS_BROADCAST_INTERVAL);
5664
5664
5665
5665
if (!Assume (peer.m_addrs_to_send .size () <= MAX_ADDR_TO_SEND)) {
5666
5666
// Should be impossible since we always check size before adding to
@@ -5747,13 +5747,13 @@ void PeerManagerImpl::MaybeSendFeefilter(CNode& pto, Peer& peer, std::chrono::mi
5747
5747
MakeAndPushMessage (pto, NetMsgType::FEEFILTER, filterToSend);
5748
5748
peer.m_fee_filter_sent = filterToSend;
5749
5749
}
5750
- peer.m_next_send_feefilter = current_time + FastRandomContext () .rand_exp_duration (AVG_FEEFILTER_BROADCAST_INTERVAL);
5750
+ peer.m_next_send_feefilter = current_time + m_rng .rand_exp_duration (AVG_FEEFILTER_BROADCAST_INTERVAL);
5751
5751
}
5752
5752
// If the fee filter has changed substantially and it's still more than MAX_FEEFILTER_CHANGE_DELAY
5753
5753
// until scheduled broadcast, then move the broadcast to within MAX_FEEFILTER_CHANGE_DELAY.
5754
5754
else if (current_time + MAX_FEEFILTER_CHANGE_DELAY < peer.m_next_send_feefilter &&
5755
5755
(currentFilter < 3 * peer.m_fee_filter_sent / 4 || currentFilter > 4 * peer.m_fee_filter_sent / 3 )) {
5756
- peer.m_next_send_feefilter = current_time + FastRandomContext () .randrange <std::chrono::microseconds>(MAX_FEEFILTER_CHANGE_DELAY);
5756
+ peer.m_next_send_feefilter = current_time + m_rng .randrange <std::chrono::microseconds>(MAX_FEEFILTER_CHANGE_DELAY);
5757
5757
}
5758
5758
}
5759
5759
@@ -6059,7 +6059,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
6059
6059
if (pto->IsInboundConn ()) {
6060
6060
tx_relay->m_next_inv_send_time = NextInvToInbounds (current_time, INBOUND_INVENTORY_BROADCAST_INTERVAL);
6061
6061
} else {
6062
- tx_relay->m_next_inv_send_time = current_time + FastRandomContext () .rand_exp_duration (OUTBOUND_INVENTORY_BROADCAST_INTERVAL);
6062
+ tx_relay->m_next_inv_send_time = current_time + m_rng .rand_exp_duration (OUTBOUND_INVENTORY_BROADCAST_INTERVAL);
6063
6063
}
6064
6064
}
6065
6065
0 commit comments