Review report

bitcoin/bitcoin: PR #36621

1 suggestion

Optional improvements

Link

[suggestion] · Out-of-range test depends on standard-library exception text

Requiring "vector" in std::out_of_range::what() couples this unit test to unspecified diagnostics and could reject a contract-preserving bounds-checking change.

Location: src/test/blockmanager_tests.cpp:216 (head).

Details and suggested fix

is_range_error accepts an exception only if its message contains "vector", but PruneBlockFiles promises only std::out_of_range and rejection before any block-index entry is modified. Both the initial bitmap access and the later file-info access use vector::at(), so the substring does not identify which one threw. The existing check_unmodified() assertions already catch partial pruning in the {file1, file2 + 1} case. Mainstream standard libraries currently include "vector" in their messages, so this is a maintenance coupling rather than a current test failure. An explicit range check with a different message could preserve the contract yet fail these assertions. Use BOOST_CHECK_THROW(..., std::out_of_range) for both calls and retain the check_unmodified() calls.


Coverage details