mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
refactor: Add ChainstateManager::CurrentChainstate() method
CurrentChainstate() is basically the same as ActiveChainstate() except it requires cs_main to be locked when it is called, instead of locking cs_main internally. The name "current" should also be less confusing than "active" because multiple chainstates can be active, and CurrentChainstate() returns the chainstate targeting the current network tip, regardless of what chainstates are being downloaded or how they are used.
This commit is contained in:
@@ -1387,7 +1387,7 @@ void PeerManagerImpl::FindNextBlocksToDownload(const Peer& peer, unsigned int co
|
||||
// When we sync with AssumeUtxo and discover the snapshot is not in the peer's best chain, abort:
|
||||
// We can't reorg to this chain due to missing undo data until the background sync has finished,
|
||||
// so downloading blocks from it would be futile.
|
||||
const CBlockIndex* snap_base{m_chainman.GetSnapshotBaseBlock()};
|
||||
const CBlockIndex* snap_base{m_chainman.CurrentChainstate().SnapshotBase()};
|
||||
if (snap_base && state->pindexBestKnownBlock->GetAncestor(snap_base->nHeight) != snap_base) {
|
||||
LogDebug(BCLog::NET, "Not downloading blocks from peer=%d, which doesn't have the snapshot block in its best chain.\n", peer.m_id);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user