MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / PruneBlockIndexCandidates

Method PruneBlockIndexCandidates

src/validation.cpp:2699–2708  ·  view source on GitHub ↗

Delete all entries in setBlockIndexCandidates that are worse than the current tip. */

Source from the content-addressed store, hash-verified

2697
2698/** Delete all entries in setBlockIndexCandidates that are worse than the current tip. */
2699void CChainState::PruneBlockIndexCandidates() {
2700 // Note that we can't delete the current block itself, as we may need to return to it later in case a
2701 // reorganization to a better block fails.
2702 std::set<CBlockIndex*, CBlockIndexWorkComparator>::iterator it = setBlockIndexCandidates.begin();
2703 while (it != setBlockIndexCandidates.end() && setBlockIndexCandidates.value_comp()(*it, chainActive.Tip())) {
2704 setBlockIndexCandidates.erase(it++);
2705 }
2706 // Either the current tip or a successor of it we're working towards is left in setBlockIndexCandidates.
2707 assert(!setBlockIndexCandidates.empty());
2708}
2709
2710/**
2711 * Try to make some progress towards making pindexMostWork the active block.

Callers 1

LoadChainTipFunction · 0.80

Calls 5

beginMethod · 0.45
endMethod · 0.45
TipMethod · 0.45
eraseMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected