Changeset View
Changeset View
Standalone View
Standalone View
src/node/chainstate.cpp
Show First 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | ChainstateLoadResult LoadChainstate(ChainstateManager &chainman, | ||||
auto snapshot_completion = chainman.MaybeCompleteSnapshotValidation(); | auto snapshot_completion = chainman.MaybeCompleteSnapshotValidation(); | ||||
if (snapshot_completion == SnapshotCompletionResult::SKIPPED) { | if (snapshot_completion == SnapshotCompletionResult::SKIPPED) { | ||||
// do nothing; expected case | // do nothing; expected case | ||||
} else if (snapshot_completion == SnapshotCompletionResult::SUCCESS) { | } else if (snapshot_completion == SnapshotCompletionResult::SUCCESS) { | ||||
LogPrintf("[snapshot] cleaning up unneeded background chainstate, then " | LogPrintf("[snapshot] cleaning up unneeded background chainstate, then " | ||||
"reinitializing\n"); | "reinitializing\n"); | ||||
if (!chainman.ValidatedSnapshotCleanup()) { | if (!chainman.ValidatedSnapshotCleanup()) { | ||||
AbortNode("Background chainstate cleanup failed unexpectedly."); | return {ChainstateLoadStatus::FAILURE_FATAL, | ||||
Untranslated( | |||||
"Background chainstate cleanup failed unexpectedly.")}; | |||||
} | } | ||||
// Because ValidatedSnapshotCleanup() has torn down chainstates with | // Because ValidatedSnapshotCleanup() has torn down chainstates with | ||||
// ChainstateManager::ResetChainstates(), reinitialize them here without | // ChainstateManager::ResetChainstates(), reinitialize them here without | ||||
// duplicating the blockindex work above. | // duplicating the blockindex work above. | ||||
assert(chainman.GetAll().empty()); | assert(chainman.GetAll().empty()); | ||||
assert(!chainman.IsSnapshotActive()); | assert(!chainman.IsSnapshotActive()); | ||||
assert(!chainman.IsSnapshotValidated()); | assert(!chainman.IsSnapshotValidated()); | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |