Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 3,062 Lines • ▼ Show 20 Lines | |||||
bool PreciousBlock(const Config &config, CValidationState &state, | bool PreciousBlock(const Config &config, CValidationState &state, | ||||
CBlockIndex *pindex) { | CBlockIndex *pindex) { | ||||
return g_chainstate.PreciousBlock(config, state, pindex); | return g_chainstate.PreciousBlock(config, state, pindex); | ||||
} | } | ||||
bool CChainState::UnwindBlock(const Config &config, CValidationState &state, | bool CChainState::UnwindBlock(const Config &config, CValidationState &state, | ||||
CBlockIndex *pindex, bool invalidate) { | CBlockIndex *pindex, bool invalidate) { | ||||
AssertLockHeld(cs_main); | AssertLockHeld(cs_main); | ||||
markblundeberg: change should go here | |||||
// We first disconnect backwards and then mark the blocks as invalid. | // We first disconnect backwards and then mark the blocks as invalid. | ||||
// This prevents a case where pruned nodes may fail to invalidateblock | // This prevents a case where pruned nodes may fail to invalidateblock | ||||
// and be left unable to start as they have no tip candidates (as there | // and be left unable to start as they have no tip candidates (as there | ||||
// are no blocks that meet the "have data and are not invalid per | // are no blocks that meet the "have data and are not invalid per | ||||
// nStatus" criteria for inclusion in setBlockIndexCandidates). | // nStatus" criteria for inclusion in setBlockIndexCandidates). | ||||
bool pindex_was_in_chain = false; | bool pindex_was_in_chain = false; | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | if (!AreOnTheSameFork(pindex, chainActive.Tip())) { | ||||
return InvalidateBlock(config, state, pindexToInvalidate); | return InvalidateBlock(config, state, pindexToInvalidate); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool InvalidateBlock(const Config &config, CValidationState &state, | bool InvalidateBlock(const Config &config, CValidationState &state, | ||||
CBlockIndex *pindex) { | CBlockIndex *pindex) { | ||||
LOCK(cs_main); | |||||
return g_chainstate.UnwindBlock(config, state, pindex, true); | return g_chainstate.UnwindBlock(config, state, pindex, true); | ||||
} | } | ||||
bool ParkBlock(const Config &config, CValidationState &state, | bool ParkBlock(const Config &config, CValidationState &state, | ||||
CBlockIndex *pindex) { | CBlockIndex *pindex) { | ||||
return g_chainstate.UnwindBlock(config, state, pindex, false); | return g_chainstate.UnwindBlock(config, state, pindex, false); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,540 Lines • Show Last 20 Lines |
change should go here