Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 3,076 Lines • ▼ Show 20 Lines | while (true) { | ||||
setDirtyBlockIndex.insert(invalid_walk_tip); | setDirtyBlockIndex.insert(invalid_walk_tip); | ||||
setBlockIndexCandidates.insert(invalid_walk_tip->pprev); | setBlockIndexCandidates.insert(invalid_walk_tip->pprev); | ||||
// If we abort invalidation after this iteration, make sure | // If we abort invalidation after this iteration, make sure | ||||
// the last disconnected block gets marked failed (rather than | // the last disconnected block gets marked failed (rather than | ||||
// just child of failed) | // just child of failed) | ||||
to_mark_failed_or_parked = invalid_walk_tip; | to_mark_failed_or_parked = invalid_walk_tip; | ||||
// Block index must always be in a good state before we unlock cs_main. | |||||
CheckBlockIndex(config.GetChainParams().GetConsensus()); | |||||
} | } | ||||
{ | { | ||||
// Mark pindex (or the last disconnected block) as invalid or parked, | // Mark pindex (or the last disconnected block) as invalid or parked, | ||||
// regardless of whether it was in the main chain or not. | // regardless of whether it was in the main chain or not. | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
if (chainActive.Contains(to_mark_failed_or_parked)) { | if (chainActive.Contains(to_mark_failed_or_parked)) { | ||||
// If the to-be-marked invalid block is in the active chain, | // If the to-be-marked invalid block is in the active chain, | ||||
Show All 19 Lines | while (true) { | ||||
!setBlockIndexCandidates.value_comp()(i, chainActive.Tip())) { | !setBlockIndexCandidates.value_comp()(i, chainActive.Tip())) { | ||||
setBlockIndexCandidates.insert(i); | setBlockIndexCandidates.insert(i); | ||||
} | } | ||||
} | } | ||||
if (invalidate) { | if (invalidate) { | ||||
InvalidChainFound(to_mark_failed_or_parked); | InvalidChainFound(to_mark_failed_or_parked); | ||||
} | } | ||||
// Block index must always be in a good state before we unlock cs_main. | |||||
CheckBlockIndex(config.GetChainParams().GetConsensus()); | |||||
} | } | ||||
// Only notify about a new block tip if the active chain was modified. | // Only notify about a new block tip if the active chain was modified. | ||||
if (pindex_was_in_chain) { | if (pindex_was_in_chain) { | ||||
uiInterface.NotifyBlockTip(IsInitialBlockDownload(), | uiInterface.NotifyBlockTip(IsInitialBlockDownload(), | ||||
to_mark_failed_or_parked->pprev); | to_mark_failed_or_parked->pprev); | ||||
} | } | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 2,564 Lines • Show Last 20 Lines |