Skip to content

Commit 156a19e

Browse files
committed
scripted-diff: rename nPeersWithValidatedDownloads
-BEGIN VERIFY SCRIPT- ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); } ren nPeersWithValidatedDownloads m_peers_downloading_from -END VERIFY SCRIPT-
1 parent b03de9c commit 156a19e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/net_processing.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ class PeerManagerImpl final : public PeerManager
514514
std::list<NodeId> lNodesAnnouncingHeaderAndIDs GUARDED_BY(cs_main);
515515

516516
/** 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;
518518

519519
/** Storage for orphan information */
520520
TxOrphanage m_orphanage;
@@ -773,7 +773,7 @@ bool PeerManagerImpl::MarkBlockAsReceived(const uint256& hash)
773773
state->nBlocksInFlight--;
774774
if (state->nBlocksInFlight == 0) {
775775
// Last validated block on the queue was received.
776-
nPeersWithValidatedDownloads--;
776+
m_peers_downloading_from--;
777777
}
778778
state->m_stalling_since = 0us;
779779
mapBlocksInFlight.erase(itInFlight);
@@ -808,7 +808,7 @@ bool PeerManagerImpl::MarkBlockAsInFlight(NodeId nodeid, const CBlockIndex* pind
808808
if (state->nBlocksInFlight == 1) {
809809
// We're starting a block download (batch) from this peer.
810810
state->m_downloading_since = GetTime<std::chrono::microseconds>();
811-
nPeersWithValidatedDownloads++;
811+
m_peers_downloading_from++;
812812
}
813813
itInFlight = mapBlocksInFlight.insert(std::make_pair(hash, std::make_pair(nodeid, it))).first;
814814
if (pit)
@@ -1134,8 +1134,8 @@ void PeerManagerImpl::FinalizeNode(const CNode& node)
11341134
WITH_LOCK(g_cs_orphans, m_orphanage.EraseForPeer(nodeid));
11351135
m_txrequest.DisconnectedPeer(nodeid);
11361136
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);
11391139
m_outbound_peers_with_protect_from_disconnect -= state->m_chain_sync.m_protect;
11401140
assert(m_outbound_peers_with_protect_from_disconnect >= 0);
11411141
m_wtxid_relay_peers -= state->m_wtxid_relay;
@@ -1147,7 +1147,7 @@ void PeerManagerImpl::FinalizeNode(const CNode& node)
11471147
// Do a consistency check after the last peer is removed.
11481148
assert(mapBlocksInFlight.empty());
11491149
assert(nPreferredDownload == 0);
1150-
assert(nPeersWithValidatedDownloads == 0);
1150+
assert(m_peers_downloading_from == 0);
11511151
assert(m_outbound_peers_with_protect_from_disconnect == 0);
11521152
assert(m_wtxid_relay_peers == 0);
11531153
assert(m_txrequest.Size() == 0);
@@ -4712,7 +4712,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
47124712
// to unreasonably increase our timeout.
47134713
if (state.vBlocksInFlight.size() > 0) {
47144714
QueuedBlock &queuedBlock = state.vBlocksInFlight.front();
4715-
int nOtherPeersWithValidatedDownloads = nPeersWithValidatedDownloads - 1;
4715+
int nOtherPeersWithValidatedDownloads = m_peers_downloading_from - 1;
47164716
if (current_time > state.m_downloading_since + std::chrono::seconds{consensusParams.nPowTargetSpacing} * (BLOCK_DOWNLOAD_TIMEOUT_BASE + BLOCK_DOWNLOAD_TIMEOUT_PER_PEER * nOtherPeersWithValidatedDownloads)) {
47174717
LogPrintf("Timeout downloading block %s from peer=%d, disconnecting\n", queuedBlock.hash.ToString(), pto->GetId());
47184718
pto->fDisconnect = true;

0 commit comments

Comments
 (0)