Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
501}503void BaseIndex::SetBestBlockIndex(const CBlockIndex* block)504{505assert(!m_chainstate->m_blockman.IsPruneMode() || AllowPrune());507if (AllowPrune()) {508node::PruneLockInfo prune_lock;509prune_lock.height_first = block ? block->nHeight : 0;510WITH_LOCK(::cs_main, m_chainstate->m_blockman.UpdatePruneLock(GetName(), prune_lock));511}513// Intentionally set m_best_block_index as the last step in this function,514// after updating prune locks above, and after making any other references515// to *this, so the BlockUntilSyncedToCurrentChain function (which checks516// m_best_block_index as an optimization) can be used to wait for the last517// BlockConnected notification and safely assume that prune locks are518// updated and that the index object is safe to delete.519m_best_block_index = block;520}