@@ -3548,6 +3548,8 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
3548
3548
3549
3549
// Address refresh broadcast
3550
3550
int64_t nNow = GetTimeMicros ();
3551
+ auto current_time = GetTime<std::chrono::microseconds>();
3552
+
3551
3553
if (pto->IsAddrRelayPeer () && !::ChainstateActive ().IsInitialBlockDownload () && pto->nNextLocalAddrSend < nNow) {
3552
3554
AdvertiseLocal (pto);
3553
3555
pto->nNextLocalAddrSend = PoissonNextSend (nNow, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
@@ -3768,13 +3770,13 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
3768
3770
LOCK (pto->m_tx_relay ->cs_tx_inventory );
3769
3771
// Check whether periodic sends should happen
3770
3772
bool fSendTrickle = pto->HasPermission (PF_NOBAN);
3771
- if (pto->m_tx_relay ->nNextInvSend < nNow ) {
3773
+ if (pto->m_tx_relay ->nNextInvSend < current_time ) {
3772
3774
fSendTrickle = true ;
3773
3775
if (pto->fInbound ) {
3774
- pto->m_tx_relay ->nNextInvSend = connman->PoissonNextSendInbound (nNow, INVENTORY_BROADCAST_INTERVAL);
3776
+ pto->m_tx_relay ->nNextInvSend = std::chrono::microseconds{ connman->PoissonNextSendInbound (nNow, INVENTORY_BROADCAST_INTERVAL)} ;
3775
3777
} else {
3776
3778
// Use half the delay for outbound peers, as there is less privacy concern for them.
3777
- pto->m_tx_relay ->nNextInvSend = PoissonNextSend (nNow, INVENTORY_BROADCAST_INTERVAL >> 1 );
3779
+ pto->m_tx_relay ->nNextInvSend = PoissonNextSend (current_time, std::chrono::seconds{ INVENTORY_BROADCAST_INTERVAL >> 1 } );
3778
3780
}
3779
3781
}
3780
3782
@@ -3889,7 +3891,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
3889
3891
connman->PushMessage (pto, msgMaker.Make (NetMsgType::INV, vInv));
3890
3892
3891
3893
// Detect whether we're stalling
3892
- const auto current_time = GetTime<std::chrono::microseconds>();
3894
+ current_time = GetTime<std::chrono::microseconds>();
3893
3895
// nNow is the current system time (GetTimeMicros is not mockable) and
3894
3896
// should be replaced by the mockable current_time eventually
3895
3897
nNow = GetTimeMicros ();
0 commit comments