mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-19 05:45:05 +01:00
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-
This commit is contained in:
parent
b03de9c753
commit
156a19ee6a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user