@@ -514,7 +514,7 @@ class PeerManagerImpl final : public PeerManager
514
514
std::list<NodeId> lNodesAnnouncingHeaderAndIDs GUARDED_BY (cs_main);
515
515
516
516
/* * Number of peers from which we're downloading blocks. */
517
- int nPeersWithValidatedDownloads GUARDED_BY (cs_main) = 0;
517
+ int m_peers_downloading_from GUARDED_BY (cs_main) = 0;
518
518
519
519
/* * Storage for orphan information */
520
520
TxOrphanage m_orphanage;
@@ -773,7 +773,7 @@ bool PeerManagerImpl::MarkBlockAsReceived(const uint256& hash)
773
773
state->nBlocksInFlight --;
774
774
if (state->nBlocksInFlight == 0 ) {
775
775
// Last validated block on the queue was received.
776
- nPeersWithValidatedDownloads --;
776
+ m_peers_downloading_from --;
777
777
}
778
778
state->m_stalling_since = 0us;
779
779
mapBlocksInFlight.erase (itInFlight);
@@ -808,7 +808,7 @@ bool PeerManagerImpl::MarkBlockAsInFlight(NodeId nodeid, const CBlockIndex* pind
808
808
if (state->nBlocksInFlight == 1 ) {
809
809
// We're starting a block download (batch) from this peer.
810
810
state->m_downloading_since = GetTime<std::chrono::microseconds>();
811
- nPeersWithValidatedDownloads ++;
811
+ m_peers_downloading_from ++;
812
812
}
813
813
itInFlight = mapBlocksInFlight.insert (std::make_pair (hash, std::make_pair (nodeid, it))).first ;
814
814
if (pit)
@@ -1134,8 +1134,8 @@ void PeerManagerImpl::FinalizeNode(const CNode& node)
1134
1134
WITH_LOCK (g_cs_orphans, m_orphanage.EraseForPeer (nodeid));
1135
1135
m_txrequest.DisconnectedPeer (nodeid);
1136
1136
nPreferredDownload -= state->fPreferredDownload ;
1137
- nPeersWithValidatedDownloads -= (state->nBlocksInFlight != 0 );
1138
- assert (nPeersWithValidatedDownloads >= 0 );
1137
+ m_peers_downloading_from -= (state->nBlocksInFlight != 0 );
1138
+ assert (m_peers_downloading_from >= 0 );
1139
1139
m_outbound_peers_with_protect_from_disconnect -= state->m_chain_sync .m_protect ;
1140
1140
assert (m_outbound_peers_with_protect_from_disconnect >= 0 );
1141
1141
m_wtxid_relay_peers -= state->m_wtxid_relay ;
@@ -1147,7 +1147,7 @@ void PeerManagerImpl::FinalizeNode(const CNode& node)
1147
1147
// Do a consistency check after the last peer is removed.
1148
1148
assert (mapBlocksInFlight.empty ());
1149
1149
assert (nPreferredDownload == 0 );
1150
- assert (nPeersWithValidatedDownloads == 0 );
1150
+ assert (m_peers_downloading_from == 0 );
1151
1151
assert (m_outbound_peers_with_protect_from_disconnect == 0 );
1152
1152
assert (m_wtxid_relay_peers == 0 );
1153
1153
assert (m_txrequest.Size () == 0 );
@@ -4712,7 +4712,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
4712
4712
// to unreasonably increase our timeout.
4713
4713
if (state.vBlocksInFlight .size () > 0 ) {
4714
4714
QueuedBlock &queuedBlock = state.vBlocksInFlight .front ();
4715
- int nOtherPeersWithValidatedDownloads = nPeersWithValidatedDownloads - 1 ;
4715
+ int nOtherPeersWithValidatedDownloads = m_peers_downloading_from - 1 ;
4716
4716
if (current_time > state.m_downloading_since + std::chrono::seconds{consensusParams.nPowTargetSpacing } * (BLOCK_DOWNLOAD_TIMEOUT_BASE + BLOCK_DOWNLOAD_TIMEOUT_PER_PEER * nOtherPeersWithValidatedDownloads)) {
4717
4717
LogPrintf (" Timeout downloading block %s from peer=%d, disconnecting\n " , queuedBlock.hash .ToString (), pto->GetId ());
4718
4718
pto->fDisconnect = true ;
0 commit comments