diff options
author | John Newbery <john@johnnewbery.com> | 2021-06-03 12:49:27 +0100 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2021-06-03 12:49:27 +0100 |
commit | 156a19ee6a22789adedcb6ab067c2eca2d3bfdfe (patch) | |
tree | d8d66cb9fb99b152a355f485993d2b6a700eb564 /src/net_processing.cpp | |
parent | b03de9c7538d85b12929a62b9ec966fd3910e660 (diff) |
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-
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 07cfd6f4e6..ed579b2c07 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -514,7 +514,7 @@ private: std::list<NodeId> lNodesAnnouncingHeaderAndIDs GUARDED_BY(cs_main); /** Number of peers from which we're downloading blocks. */ - int nPeersWithValidatedDownloads GUARDED_BY(cs_main) = 0; + int m_peers_downloading_from GUARDED_BY(cs_main) = 0; /** Storage for orphan information */ TxOrphanage m_orphanage; @@ -773,7 +773,7 @@ bool PeerManagerImpl::MarkBlockAsReceived(const uint256& hash) state->nBlocksInFlight--; if (state->nBlocksInFlight == 0) { // Last validated block on the queue was received. - nPeersWithValidatedDownloads--; + m_peers_downloading_from--; } state->m_stalling_since = 0us; mapBlocksInFlight.erase(itInFlight); @@ -808,7 +808,7 @@ bool PeerManagerImpl::MarkBlockAsInFlight(NodeId nodeid, const CBlockIndex* pind if (state->nBlocksInFlight == 1) { // We're starting a block download (batch) from this peer. state->m_downloading_since = GetTime<std::chrono::microseconds>(); - nPeersWithValidatedDownloads++; + m_peers_downloading_from++; } itInFlight = mapBlocksInFlight.insert(std::make_pair(hash, std::make_pair(nodeid, it))).first; if (pit) @@ -1134,8 +1134,8 @@ void PeerManagerImpl::FinalizeNode(const CNode& node) WITH_LOCK(g_cs_orphans, m_orphanage.EraseForPeer(nodeid)); m_txrequest.DisconnectedPeer(nodeid); nPreferredDownload -= state->fPreferredDownload; - nPeersWithValidatedDownloads -= (state->nBlocksInFlight != 0); - assert(nPeersWithValidatedDownloads >= 0); + m_peers_downloading_from -= (state->nBlocksInFlight != 0); + assert(m_peers_downloading_from >= 0); m_outbound_peers_with_protect_from_disconnect -= state->m_chain_sync.m_protect; assert(m_outbound_peers_with_protect_from_disconnect >= 0); m_wtxid_relay_peers -= state->m_wtxid_relay; @@ -1147,7 +1147,7 @@ void PeerManagerImpl::FinalizeNode(const CNode& node) // Do a consistency check after the last peer is removed. assert(mapBlocksInFlight.empty()); assert(nPreferredDownload == 0); - assert(nPeersWithValidatedDownloads == 0); + assert(m_peers_downloading_from == 0); assert(m_outbound_peers_with_protect_from_disconnect == 0); assert(m_wtxid_relay_peers == 0); assert(m_txrequest.Size() == 0); @@ -4712,7 +4712,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto) // to unreasonably increase our timeout. if (state.vBlocksInFlight.size() > 0) { QueuedBlock &queuedBlock = state.vBlocksInFlight.front(); - int nOtherPeersWithValidatedDownloads = nPeersWithValidatedDownloads - 1; + int nOtherPeersWithValidatedDownloads = m_peers_downloading_from - 1; if (current_time > state.m_downloading_since + std::chrono::seconds{consensusParams.nPowTargetSpacing} * (BLOCK_DOWNLOAD_TIMEOUT_BASE + BLOCK_DOWNLOAD_TIMEOUT_PER_PEER * nOtherPeersWithValidatedDownloads)) { LogPrintf("Timeout downloading block %s from peer=%d, disconnecting\n", queuedBlock.hash.ToString(), pto->GetId()); pto->fDisconnect = true; |