Review report

bitcoin/bitcoin: PR #36778

2 minor findings · 5 suggestions

Findings

Link

[minor] · The public loadtxoutset RPC has no deprecation grace period

The RPC now unconditionally returns method-not-found, breaking existing callers without the one-major-release compatibility path described in the developer notes.

Location: src/rpc/blockchain.cpp:3516 (head).

Details and suggested fix

Moving the method to the hidden category preserves an explanatory error, not its functionality. Existing callers must now arrange a restart and a genesis-only receiver, so migration is not a drop-in RPC change. The documented deprecation process calls for retaining the old behavior behind -deprecatedrpc=loadtxoutset for one major release and mentioning that flag in help. That compatibility path would need to retain the runtime mempool and work checks, cache handling, and service updates removed here. If this removal is an intentional exception approved elsewhere, document the exception and migration timeline in the release note; neither is recorded in the checkout.


Link

[minor] · An older startup wallet can prevent background validation after import

A startup wallet needing pre-snapshot blocks can abort initialization after the snapshot is persisted, and restarting without the import option still cannot begin background validation.

Location: doc/assumeutxo.md:18 (head).

Details and suggested fix

The import now completes before LoadWallets. If a configured wallet's saved locator and birthday still require history below the snapshot base, AttachChain rejects it because that block data is unavailable. Wallet loading then aborts startup before the background initialization thread and networking start. Previously an already-loaded wallet could remain active across runtime activation; the converted test instead restores it after importing. Retrying without -loadtxoutset preserves the snapshot but encounters the same wallet failure, so the error's advice to wait for synchronization cannot resolve itself. Document restarting without the import option and with -nowallet until background validation supplies the required history, then loading the wallet. Add coverage for this startup failure and recovery.


Optional improvements

Link

[suggestion] · Snapshot file-open failures expose an internal AutoFile error

A missing path or denied read permission is reported as AutoFile::read: file handle is nullptr, without the operating-system reason.

Location: src/init.cpp:1543 (head).

Details and suggested fix

The startup caller wraps the result of fopen and immediately deserializes metadata without checking IsNull(). If opening fails, AutoFile::detail_fread throws its null-handle diagnostic, and the catch includes that text in the startup error. The old RPC reported an explicit file-open failure. Check snapshot_file.IsNull() immediately after opening and report that the path could not be opened for reading, including SysErrorString(errno). Tighten test_invalid_file_path to check the specific diagnostic rather than only its outer prefix.


Link

[suggestion] · Startup-import tests do not isolate persisted unfinished reindexing

Removing the unfinished-reindex condition would leave the new rejection cases passing because they fail earlier or have another disqualifying state.

Location: test/functional/feature_assumeutxo.py:237 (head).

Details and suggested fix

The command-line conflict cases exit before loading the block index. The advanced-chainstate and stored-block cases reject independently of m_blockfiles_indexed, while the reindex cycles finish before importing again. None isolates the marker restored by ReadReindexing. Add an initialization fixture with the required headers, an empty or genesis chainstate, no post-genesis BLOCK_HAVE_DATA entries, and WriteReindexing(true) persisted on disk. Start with only -loadtxoutset and assert the unfinished-state rejection before snapshot population. This would cover the separate recovery state that startup must reject before block importing can resume reindexing.


Link

[suggestion] · Persisted snapshot spends do not test the mempool-load ordering

Loading the mempool before importing could reject snapshot spends while the current test still observes loaded=true and an empty pool.

Location: test/functional/feature_assumeutxo.py:89 (head).

Details and suggested fix

The import helper waits for mempool loading to finish, but the receivers do not begin their imports with persisted transactions spending snapshot coins. The spending transaction is submitted only afterward. If loading moved before activation, validation against genesis could reject those transactions and leave the pool empty, so the activation assertion would not catch the regression. Put a mempool.dat containing a nonexpired spend of a mature, unspent snapshot coin into a stopped receiver before its first import. After importing, assert that the exact transaction is in its mempool before connecting any peers.


Link

[suggestion] · Interrupted startup import and same-datadir retry lack coverage

No snapshot test exercises cancellation through the new INTERRUPTED startup result and then retries the import without manual cleanup.

Location: src/init.cpp:1548 (head).

Details and suggested fix

An interrupted population or commitment hash returns an error through cleanup_bad_snapshot, and the startup caller maps it to INTERRUPTED rather than a fatal initialization error. Malformed-snapshot retries cover ordinary error cleanup, not this shutdown path. The successful-import helper also deletes the ordinary chainstate before importing, so it cannot demonstrate recovery as-is. Add a deterministic functional test that requests shutdown during startup activation, checks clean exit and removal of the staged snapshot database, then restarts with the same datadir and import option without deleting anything. Assert that the retry imports successfully.


Link

[suggestion] · Startup snapshot loading leaves the splash screen without progress

Qt users see a static loading message throughout deserialization, flushing, and hashing, although the loader already calculates a loaded-coin percentage.

Location: src/init.cpp:1546 (head).

Details and suggested fix

The single InitMessage does not use the splash's ShowProgress path, which supplies the percentage and shutdown hint. The existing counter reports progress only to the log, and the subsequent flush and commitment-hashing phases leave the same message displayed. Q and closing the window already request shutdown, so the limitation is feedback and discoverability. Send throttled GetNotifications().progress() updates from the coin counter and use a separate status for hashing. Pass resume_possible=false, since cancellation discards the staged import rather than preserving partial progress.


Coverage details