2 minor findings · 7 suggestions
Earlier concerns neither republished nor resolved: 2 minor findings. See the Run archive for their assessments.
Findings
[minor] · Startup read aborts bypass guided database recovery
Startup LevelDB point-read failures now bypass the rebuild/reindex guidance and the kernel API's null-return path, without replacement recovery guidance or a complete update to the API contract.
Location: src/dbwrapper.cpp:365 (head).
Details and suggested fix
A LevelDB failure while the constructor reads OBFUSCATION_KEY now reaches FatalReadError() and aborts before the initialization handlers can offer a GUI rebuild, print the bitcoind reindex hint, or return null from btck_chainstate_manager_create(). The log identifies the database, but the fatal notification gives only a generic shutdown message. Persistent corruption can therefore produce the same abort on subsequent ordinary restarts. If startup abort remains the policy, add database-specific recovery guidance to the fatal diagnostic and release note, distinguishing when -reindex-chainstate or -reindex is appropriate. Also document process termination in the create function and the kernel's general error-handling section. Database-open failures remain separate, and this concern is specifically about newly fatal loading reads, not coin-read failures that already aborted.
[minor] · Scratch UTXO read failures now abort the node
A local read or decoding failure during disk-backed dumptxoutset rollback now aborts the node and leaves temp_utxo_<height> behind, instead of failing only the RPC.
Location: src/rpc/blockchain.cpp:3270 (head).
Details and suggested fix
CreateRolledBackUTXOSnapshot() creates a disposable database beside the caller's output path and reads it through rollback_cache during DisconnectBlock(). Previously, database and coin-decoding errors threw from this directly backed view, so the RPC failed and TemporaryUTXODatabase could clean up during unwinding. The shared fatal-read path now aborts the process, skipping that cleanup even though this database holds no persistent node state. Preserve an RPC-local failure path for scratch reads and reject the snapshot on any such error, rather than applying the node-fatal policy here. That propagation must accommodate the new noexcept coin interface; simply throwing from GetCoin() or leaving .notifications unset would still terminate the process.
Optional improvements
[suggestion] · Optional-index corruption can abort the node on request paths
With the relevant services enabled, a peer or REST request that reaches an already-corrupt optional-index entry can now stop validation and relay, rather than fail only that request.
Location: src/index/blockfilterindex.cpp:97 (head).
Details and suggested fix
With -blockfilterindex and -peerblockfilters, an allowed getcfheaders request with a nonzero start height reaches LookupFilterHeader() and a typed point read when the header is not cached. With -txindex and -rest, /rest/tx can similarly reach a failing txindex read. The corruption must already exist locally; clients cannot create it, and cached headers or iterator-based reads do not necessarily trigger the abort. Nevertheless, applying this policy to rebuildable, non-consensus indexes makes unrelated node services terminate and leaves persistent corruption available to trigger another failure after restart. I recommend retaining an explicit optional-index error path that fails the request rather than unconditionally aborting the node. It must distinguish unreadable data from a missing entry, rather than restoring the old decoding-error-as-not-found behavior.
[suggestion] · The fatal_error callback lacks a thread and lock contract
Database failures can invoke the host's fatal_error callback synchronously and concurrently on prevout-fetch workers while validation holds cs_main, but the public header does not document those constraints.
Location: src/kernel/bitcoinkernel.h:542 (head).
Details and suggested fix
A prevout worker calls base->PeekCoin() before setting input.ready. A database failure now invokes the host's fatal_error callback directly on that worker before aborting. Meanwhile, validation can hold cs_main while waiting for readiness, and several workers can report failures concurrently. A callback that synchronously destroys the chainstate manager, which also takes that mutex, or waits for validation progress can therefore block before the abort occurs. No checked-in handler performing that blocking teardown was found. Document that fatal_error runs synchronously on the reporting thread, may run concurrently on internal workers while locks are held, and must not re-enter the library or wait for validation. The existing warning that the process may abort after the callback returns does not convey these restrictions.
[suggestion] · The startup corruption test does not distinguish abort from ordinary failure
The chainstate/*.ldb case accepts any nonzero exit, so a regression that emits the fatal notification but then exits through initialization-error handling would still pass.
Location: test/functional/feature_init.py:168 (head).
Details and suggested fix
The new point-read corruption expectation uses assert_start_raises_init_error(), which checks only ret != 0 and a partial stderr match. It therefore does not establish the startup abort policy that this PR introduces. For this perturbation round, start the process without waiting for RPC and call wait_until_aborted(fatal_error="Error reading from database, shutting down.") so the test also checks an abort exit status. Keep the chainstate/CURRENT database-open failure on the existing initialization-error path.
[suggestion] · Later lookups mask missing HaveInputs cache coverage
A HaveInputs() implementation that skipped its lookup could still pass this test because the later GetCoin() supplies the expected single backing read.
Location: src/test/coins_tests.cpp:1097 (head).
Details and suggested fix
The test checks base.getcoin_calls only after GetCoin(), AccessCoin() and HaveCoin(). If HaveInputs() simply returned true, its two assertions would pass and the following GetCoin() would make the one backing read expected by the final assertion. Assert getcoin_calls == (prefilled ? 0 : 1) and HaveCoinInCache(outpoint) immediately after the first HaveInputs() to establish that it performed the fetch. Retain the final count assertion to verify that later operations make no additional backing reads.
[suggestion] · The missing-block-sequence txindex abort lacks targeted coverage
The existing failure tests exercise block-file and LevelDB errors, so they would not detect a regression confined to the newly fatal missing-BlockSeqKey branch.
Location: src/index/txindex.cpp:184 (head).
Details and suggested fix
FindTx() now aborts when a hashed transaction entry refers to an absent BlockSeqKey. The four lookups in feature_io_errors.py instead remove blk00000.dat and expect the file-open diagnostic. feature_coinsdb_read_error.py expects a LevelDB read failure, not a successful not-found result. Add a targeted fixture that indexes a transaction, deletes its referenced BlockSeqKey while retaining the hashed transaction entry, and then queries it in a subprocess. Require the Corrupt index: block sequence diagnostic and an abort exit status so returning an RPC error or a lookup miss would fail the test.
[suggestion] · CCoinsViewBacked::GetCoin forwarding is unused after catcher removal
Removing the catcher removes the last qualified call to this forwarding body, while both remaining subclasses provide their own GetCoin implementation.
Location: src/coins.cpp:449 (base).
Details and suggested fix
CCoinsViewErrorCatcher::GetCoin() explicitly called CCoinsViewBacked::GetCoin(). With that caller removed, the remaining cache and mempool subclasses override the method, and CCoinsViewBacked is not instantiated directly. Remove just this forwarding override and leave the pure declaration from CCoinsView in force. The other forwarding methods can remain unchanged.
[suggestion] · The new string_view include in base.h is unused
Nothing in src/index/base.h uses std::string_view, so the new include is unnecessary.
Location: src/index/base.h:28 (head).
Details and suggested fix
The inlined FatalError() helper uses formatting, translation, assertions and notifications, whose headers are already included. It does not use std::string_view, nor does the rest of this header. Remove the newly added <string_view> include.
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