Review report

bitcoin/bitcoin: PR #35003

2 suggestions

Earlier concerns neither republished nor resolved: 1 minor finding. See the Run archive for their assessments.

Optional improvements

Link

[suggestion] · Write-open failure coverage is skipped on root and Windows

The permission-based write-open unit test passes without checking the new null-return behavior on Windows or root runs.

Location: src/test/flatfile_tests.cpp:170 (head).

Details and suggested fix

SimulateFileSystemError returns before invoking its callback on Windows or when getuid() == 0, so neither Open() nor its null assertion runs. Add a permission-independent case: create a regular file at file_path, construct FlatFileSeq(file_path / "blocks", "a", DUMMY_CHUNK_SZ), and check that Open(FlatFilePos(0, 0), /*read_only=*/false) returns null without throwing. A regular file cannot serve as a parent directory, so this exercises the new error_code branch without relying on permissions. The base implementation would throw for that input. Keep the existing permission-based case for the inaccessible-directory scenario.


Link

[suggestion] · Connect-failure recovery assertions can pass without reconnecting

The connect-failure unit test accepts no-op success from ActivateBestChain, so its recovery assertions do not directly establish that the disconnected tip returns.

Location: src/test/validation_chainstate_tests.cpp:212 (head).

Details and suggested fix

ActivateBestChain() returns true with the supplied valid state unchanged when FindMostWorkChain() finds no candidate. If a regression drops the disconnected block from the candidate set, the recovery checks can therefore pass without reconnecting it. The next iteration would expose such a loss in the first iteration, but the final directory-failure iteration has no later check. Save ActiveTip() before DisconnectTip() and compare it with the tip after each recovery call, holding the chainman mutex for both reads.


Coverage details

Earlier concerns

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