mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-15 04:30:42 +02:00
[net processing] Clarify UpdatedBlockTip()
This commit is contained in:
parent
94d2cc35be
commit
f6360088de
@ -1296,8 +1296,9 @@ void PeerManager::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockInde
|
||||
m_connman.SetBestHeight(pindexNew->nHeight);
|
||||
SetServiceFlagsIBDCache(!fInitialDownload);
|
||||
|
||||
// Relay inventory, but don't relay old inventory during initial block download.
|
||||
if (!fInitialDownload) {
|
||||
// Don't relay inventory during initial block download.
|
||||
if (fInitialDownload) return;
|
||||
|
||||
// Find the hashes of all blocks that weren't previously in the best chain.
|
||||
std::vector<uint256> vHashes;
|
||||
const CBlockIndex *pindexToAnnounce = pindexNew;
|
||||
@ -1310,6 +1311,8 @@ void PeerManager::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockInde
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Relay to all peers
|
||||
m_connman.ForEachNode([&vHashes](CNode* pnode) {
|
||||
LOCK(pnode->cs_inventory);
|
||||
for (const uint256& hash : reverse_iterate(vHashes)) {
|
||||
@ -1317,7 +1320,6 @@ void PeerManager::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockInde
|
||||
}
|
||||
});
|
||||
m_connman.WakeMessageHandler();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user