mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
validation: return VerifyDBResult::INTERRUPTED if verification was interrupted
This means that the -verifydb RPC will now return false if it cannot finish due to the node being shutdown.
This commit is contained in:
parent
6360b5302d
commit
d6f781f1cf
@ -193,6 +193,7 @@ ChainstateLoadResult VerifyLoadedChainstate(ChainstateManager& chainman, const C
|
||||
options.check_blocks);
|
||||
switch (result) {
|
||||
case VerifyDBResult::SUCCESS:
|
||||
case VerifyDBResult::INTERRUPTED:
|
||||
break;
|
||||
case VerifyDBResult::CORRUPTED_BLOCK_DB:
|
||||
return {ChainstateLoadStatus::FAILURE, _("Corrupted block database detected")};
|
||||
|
@ -4146,7 +4146,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
|
||||
skipped_l3_checks = true;
|
||||
}
|
||||
}
|
||||
if (ShutdownRequested()) return VerifyDBResult::SUCCESS;
|
||||
if (ShutdownRequested()) return VerifyDBResult::INTERRUPTED;
|
||||
}
|
||||
if (pindexFailure) {
|
||||
LogPrintf("Verification error: coin database inconsistencies found (last %i blocks, %i good transactions before that)\n", chainstate.m_chain.Height() - pindexFailure->nHeight + 1, nGoodTransactions);
|
||||
@ -4179,7 +4179,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
|
||||
LogPrintf("Verification error: found unconnectable block at %d, hash=%s (%s)\n", pindex->nHeight, pindex->GetBlockHash().ToString(), state.ToString());
|
||||
return VerifyDBResult::CORRUPTED_BLOCK_DB;
|
||||
}
|
||||
if (ShutdownRequested()) return VerifyDBResult::SUCCESS;
|
||||
if (ShutdownRequested()) return VerifyDBResult::INTERRUPTED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -352,6 +352,7 @@ arith_uint256 CalculateHeadersWork(const std::vector<CBlockHeader>& headers);
|
||||
enum class VerifyDBResult {
|
||||
SUCCESS,
|
||||
CORRUPTED_BLOCK_DB,
|
||||
INTERRUPTED,
|
||||
};
|
||||
|
||||
/** RAII wrapper for VerifyDB: Verify consistency of the block and coin databases */
|
||||
|
Loading…
Reference in New Issue
Block a user