Skip to content

Commit 519ec26

Browse files
committed
Merge bitcoin/bitcoin#27157: init: Return ChainstateLoadStatus::INTERRUPTED when verification was interrupted.
c5825e1 doc: add explanation for fail_on_insufficient_dbcache (Ryan Ofsky) 7dff7da init: Return more fitting ChainStateLoadStatus if verification was interrupted (Martin Zumsande) Pull request description: This addresses two outstanding comments by ryanofsky from #25574: * return `ChainstateLoadStatus::INTERRUPTED` instead of `ChainstateLoadStatus::SUCCESS` if verification was stopped by an interrupt. This would coincide with straightforward expectation, and it avoids a misleading [log entry](https://github.com/mzumsande/bitcoin/blob/c5825e14f8999a8c5f5121027af9e07ac51ab42e/src/init.cpp#L1526) in `init` for the block index load time (because that would include the verificiation, which didn't complete). It shouldn't affect node behavior otherwise because the shutdown signal would be caught in init anyway. In test, this would lead to an assert ([link](https://github.com/mzumsande/bitcoin/blob/c5825e14f8999a8c5f5121027af9e07ac51ab42e/src/test/util/setup_common.cpp#L230)), which also makes more sense because benign interrupts are not expected there during init. This can be tested by setting a large value for `-checkblocks`, interrupting the node during block verification and observing the log. bitcoin/bitcoin#25574 (comment) * add documentation for `require_full_verification` bitcoin/bitcoin#25574 (comment) ACKs for top commit: MarcoFalke: thanks lgtm ACK c5825e1 Tree-SHA512: ca1c71a1b046d30083337dd9ef6d52e66fa1ac8c4ecd807716e4aa6a894179a81df41caee916fa30997fd6e0b284412a3c8f2919d19c29d826fb580ffb89fd73
2 parents e60a58f + c5825e1 commit 519ec26

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/node/chainstate.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,10 @@ ChainstateLoadResult VerifyLoadedChainstate(ChainstateManager& chainman, const C
198198
options.check_blocks);
199199
switch (result) {
200200
case VerifyDBResult::SUCCESS:
201-
case VerifyDBResult::INTERRUPTED:
202201
case VerifyDBResult::SKIPPED_MISSING_BLOCKS:
203202
break;
203+
case VerifyDBResult::INTERRUPTED:
204+
return {ChainstateLoadStatus::INTERRUPTED, _("Block verification was interrupted")};
204205
case VerifyDBResult::CORRUPTED_BLOCK_DB:
205206
return {ChainstateLoadStatus::FAILURE, _("Corrupted block database detected")};
206207
case VerifyDBResult::SKIPPED_L3_CHECKS:

src/node/chainstate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ struct ChainstateLoadOptions {
2525
bool reindex{false};
2626
bool reindex_chainstate{false};
2727
bool prune{false};
28+
//! Setting require_full_verification to true will require all checks at
29+
//! check_level (below) to succeed for loading to succeed. Setting it to
30+
//! false will skip checks if cache is not big enough to run them, so may be
31+
//! helpful for running with a small cache.
2832
bool require_full_verification{true};
2933
int64_t check_blocks{DEFAULT_CHECKBLOCKS};
3034
int64_t check_level{DEFAULT_CHECKLEVEL};

0 commit comments

Comments
 (0)