HomePhabricator

init, validation: Improve handling if VerifyDB() fails due to insufficient…

Description

init, validation: Improve handling if VerifyDB() fails due to insufficient dbcache

Summary:
The rpc command verifychain now fails if the dbcache was not sufficient
to complete the verification at the specified level and depth.

In the same situation, the VerifyDB check during Init will now fail (and lead to
an early shutdown) if the user has explicitly specified -checkblocks or
-checklevel but the check couldn't be executed because of the limited
cache. If the user didn't change any of the two and is using the defaults, log a warning
but don't prevent the node from starting up.

This is a partial backport of core#25574
https://github.com/bitcoin/bitcoin/pull/25574/commits/0c7785bb2540b69564104767d38342704230cbc2

Depends on D14927

Test Plan:

$ src/bitcoin-cli verifychain 4 10000
false
$ src/bitcoind -dbcache=10
...
2023-12-06T13:33:04Z Verifying last 10000 blocks at level 4
2023-12-06T13:33:04Z Verification progress: 0%
2023-12-06T13:33:04Z Verification progress: 10%
2023-12-06T13:33:04Z Verification progress: 20%
2023-12-06T13:33:04Z Verification progress: 30%
2023-12-06T13:33:04Z Verification progress: 40%
2023-12-06T13:33:04Z Verification progress: 50%
2023-12-06T13:33:04Z Skipped verification of level >=3 (insufficient database cache size). Consider increasing -dbcache.
...

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14928

Details

Provenance
Martin Zumsande <mzumsande@gmail.com>Authored on Oct 6 2022, 21:11
PiRKCommitted on Dec 7 2023, 16:25
PiRKPushed on Dec 7 2023, 16:25
Reviewer
Restricted Project
Differential Revision
D14928: init, validation: Improve handling if VerifyDB() fails due to insufficient dbcache
Parents
rABC30388014c4bd: validation: return VerifyDBResult::INTERRUPTED if verification was interrupted
Branches
Unknown
Tags
Unknown