3 suggestions
Optional improvements
[suggestion] · Startup warning omits manual cleanup for abandoned snapshot loads
If the operator abandons the snapshot or a retry fails before database initialization, the warning provides no cleanup option for the unused directory, which remains on disk and triggers warnings on later startups.
Location: src/node/utxo_snapshot.cpp:60 (head).
Details and suggested fix
loadtxoutset reaches the new wipe only after the activation preconditions pass. For example, the forked-headers check returns earlier and tells the operator to sync without AssumeUTXO. Startup otherwise ignores a directory without base_blockhash, and reindex cleanup requires a successfully loaded snapshot chainstate. Keep the corrected path arguments, but retain manual deletion guidance alongside the retry option: explain that a retry reaching database initialization replaces the directory, or that the operator can delete it while the node is stopped if no snapshot will be loaded.
[suggestion] · Retry coverage stops before successful snapshot activation
The new malformed-directory fixture tests opening and failure cleanup, not successful activation after replacement or the corrected missing-marker startup warning.
Location: test/functional/feature_assumeutxo.py:221 (head).
Details and suggested fix
Both calls create the markerless fixture on a running n0, at heights 299 and 399 for the height-299 snapshot. The expected-error assertion protects wipe-before-open, but the work check returns before any coins are read or base_blockhash is written, and failure cleanup removes the fixture. The later successful n1 load has no leftover fixture, while the invalid-chainstate startup case writes a marker. Keep this case and add the same markerless directory before n1's existing successful load. To cover startup too, restart n1 inside assert_debug_log, preserving its extra_args and mocktime, and assert the corrected warning paths. The existing coins_loaded and gettxoutsetinfo checks can then cover successful activation after replacement.
[suggestion] · Snapshot wipe omits its lock-based safety rationale
The new on-disk wipe relies on LevelDB acquiring the database lock before deleting files, but the call site does not explain that safety requirement or why replacement is needed.
Location: src/validation.cpp:5690 (head).
Details and suggested fix
An overlapping load can pass the active-snapshot guard while another snapshot is still populating its local chainstate outside cs_main, before AddChainstate. The database remains protected because CDBWrapper invokes DestroyDB before opening it, and DestroyDB acquires LOCK before deleting files; a held lock causes an exception without deleting the database files. Add a short comment above InitCoinsDB explaining both the interrupted-load leftovers being replaced and this lock requirement, so later changes preserve lock-aware deletion. The nearby cleanup comment explains releasing the lock for failure cleanup, not why this destructive open is safe.