Page MenuHomePhabricator

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

Authored by PiRK on Dec 6 2023, 14:37.

Details

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.
...

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable