Review report

core: PR #36586

3 suggestions

Earlier concerns neither republished nor resolved: 2 minor findings · 1 suggestion. See the Run archive for their assessments.

Optional improvements

Link

[suggestion] · Zero estimates provide no compaction-specific disk headroom

On disk-backed regtest and custom signet nodes, the zero assumed size reduces this guard to 50 MiB regardless of the database size.

Location: src/validation.cpp:2837 (head).

Details and suggested fix

AssumedChainStateSize() is a release-time guideline taken from a synced node with 5-10% overhead, not the size of this database. Once a disk-backed regtest or custom -signetchallenge chain leaves IBD and wins the scheduling draw, a multi-GiB database can therefore start compaction with little free space and may exhaust it. The ordinary flush check scales with dirty coins, not database size. Nonzero release estimates can also fall behind the local database, although exceeding an estimate alone does not prove insufficient peak headroom. Use the maximum of the current chainparam allowance and CoinsDB().EstimateSize() to retain today's threshold while incorporating the existing approximate coin-range size. That estimate includes obsolete entries in live tables, so it can defer bloated databases more often, and it is not an exact peak-space bound. The release note currently describes deferral without the zero-estimate limitation. This is incomplete protection, not a regression from base, which had no check. No deployed custom-signet or regtest node with a large chainstate was identified, so production impact remains unconfirmed.


Link

[suggestion] · Deferral warning understates the required free space

Near the threshold, the warning can report more free space than “needed” because it omits CheckDiskSpace's 50 MiB reserve.

Location: src/validation.cpp:2841 (head).

Details and suggested fix

CheckDiskSpace(path, min_free_space) requires min_free_space + 50_MiB, while the warning prints only CeilDiv(min_free_space, 1_GiB). With mainnet's 14 GiB allowance, 14 GiB plus 20 MiB fails the check but prints approximately “14.02 GiB free, 14 GiB needed”. A small completed flush can reach this range because its earlier coin-flush check reserves only 50 MiB plus 192 bytes per dirty coin. An operator who frees space to the displayed target can therefore remain deferred. Use a shared calculation of the total requirement, including the reserve, and one available-space query for both the comparison and warning. Print both amounts at matching precision. This also avoids the second fs::space() query reporting a different observation, without changing admission behavior.


Link

[suggestion] · Low-space compaction scheduling has no deterministic regression test

Existing compaction tests bypass the scheduling gate, while the chainstate-write fixtures use in-memory databases, so these assertions cannot catch a removed or inverted space check.

Location: src/validation.cpp:2838 (head).

Details and suggested fix

coins_db_leveldb_layout checks compaction after calling CompactFullAsync() directly, and the coins_view fuzz target also calls it directly. Neither exercises this gate. chainstate_write_tests uses the default in-memory coins DB and checks flush notifications and flushed-block positions, which are determined before the scheduling branch. The gate additionally depends on a 1-in-320 draw outside IBD, and regtest's size allowance is zero. These assertions do not distinguish removing or inverting the space check, or removing the memory-only exclusion. Add deterministic seams for the compaction-due decision and available-space query. Assert that insufficient space skips compaction without failing the completed flush, sufficient space schedules it, and memory-only databases bypass disk-compaction scheduling. Include a nonzero allowance and the 50 MiB reserve boundary so the test does not depend on filling the CI disk or winning a random draw.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.