Skip to content

Commit d6f781f

Browse files
committed
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.
1 parent 6360b53 commit d6f781f

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/node/chainstate.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ ChainstateLoadResult VerifyLoadedChainstate(ChainstateManager& chainman, const C
193193
options.check_blocks);
194194
switch (result) {
195195
case VerifyDBResult::SUCCESS:
196+
case VerifyDBResult::INTERRUPTED:
196197
break;
197198
case VerifyDBResult::CORRUPTED_BLOCK_DB:
198199
return {ChainstateLoadStatus::FAILURE, _("Corrupted block database detected")};

src/validation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4146,7 +4146,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
41464146
skipped_l3_checks = true;
41474147
}
41484148
}
4149-
if (ShutdownRequested()) return VerifyDBResult::SUCCESS;
4149+
if (ShutdownRequested()) return VerifyDBResult::INTERRUPTED;
41504150
}
41514151
if (pindexFailure) {
41524152
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(
41794179
LogPrintf("Verification error: found unconnectable block at %d, hash=%s (%s)\n", pindex->nHeight, pindex->GetBlockHash().ToString(), state.ToString());
41804180
return VerifyDBResult::CORRUPTED_BLOCK_DB;
41814181
}
4182-
if (ShutdownRequested()) return VerifyDBResult::SUCCESS;
4182+
if (ShutdownRequested()) return VerifyDBResult::INTERRUPTED;
41834183
}
41844184
}
41854185

src/validation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ arith_uint256 CalculateHeadersWork(const std::vector<CBlockHeader>& headers);
352352
enum class VerifyDBResult {
353353
SUCCESS,
354354
CORRUPTED_BLOCK_DB,
355+
INTERRUPTED,
355356
};
356357

357358
/** RAII wrapper for VerifyDB: Verify consistency of the block and coin databases */

0 commit comments

Comments
 (0)