2 minor findings · 1 suggestion
Earlier concerns neither republished nor resolved: 2 minor findings. See the Run archive for their assessments.
Findings
[minor] · Startup database corruption aborts before reindex recovery is offered
A corrupt chainstate or block-index entry at startup now aborts before GUI users see the rebuild prompt or bitcoind receives reindex guidance, despite the description saying database-open failures are unchanged.
Location: src/dbwrapper.cpp:358 (head).
Details and suggested fix
During startup, CDBWrapper reads the obfuscation key, and chainstate loading performs further point reads, including GetBestBlock(), ReplayBlocks(), VerifyDB(), and block-tree metadata reads. Before this change, a LevelDB failure in these reads threw dbwrapper_error and could be handled as a chainstate-load failure, leading AppInitMain to offer GUI users a database rebuild or tell bitcoind to restart with -reindex or -reindex-chainstate. Now ReadImpl() calls FatalReadError(), which logs a fatal error and aborts before those handlers run. The updated feature_init.py case also changes the reported error for corrupted chainstate/*.ldb files. Keep a throwing read path during database construction and chainstate loading, and use the abort behavior only after loading succeeds. This preserves the reindex recovery path without treating an unreadable entry as absent.
[minor] · Kernel database read failures abort without notifying the host
On local database corruption, a coins or block-tree read can abort a libbitcoinkernel host without its fatal_error callback, instead of returning null from btck_chainstate_manager_create as documented; impact on external users is unconfirmed.
Location: src/kernel/chainstatemanager_opts.h:47 (head).
Details and suggested fix
The kernel C API constructs the chainstate and block-tree database parameters without setting read_error_cb. A startup point-read failure in either database therefore reaches std::abort() without calling KernelNotifications::fatalError, which forwards errors to the host's fatal_error callback. It also bypasses btck_chainstate_manager_create's exception handler, which previously returned null for database-read exceptions and is documented to return null on error. Runtime coin reads already aborted through CCoinsViewErrorCatcher without callbacks; the changed paths are startup and block-tree reads. Set a default read-error callback when the kernel builds the coin and block-tree DBParams, forwarding the error through notifications.fatalError, and document the process-termination behavior in the C API. This requires on-disk corruption, and no in-repository kernel consumer or test exercises the behavior, so its impact on external users is unconfirmed.
Optional improvements
[suggestion] · Read-error test accepts the old RPC error path
If point reads become non-fatal again, this test step still passes and the test fails only later on a shutdown timeout.
Location: test/functional/feature_coinsdb_read_error.py:43 (head).
Details and suggested fix
trigger_read_error accepts a JSONRPCException with code -1 and the message Fatal LevelDB error. That message comes from HandleError(), which ReadImpl() no longer calls, so this branch at the current head would indicate a regression that made point reads throw again. The test would nevertheless continue and fail later when assert_shutdown times out waiting for the node to stop. Make the branch fail immediately, for example with raise AssertionError('read error was returned via RPC instead of aborting the node'), or remove it.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [minor]: A throwing read-error callback can bypass termination
- [minor]: A throwing read-error callback can bypass termination