Review report

bitcoin/bitcoin: PR #36740

1 suggestion

Optional improvements

Link

[suggestion] · SRD regression failures reach an unchecked result assertion

If SRD returns an error under a tie-break regression, this unit test reaches a util::Result assertion instead of reporting a scenario-specific Boost failure.

Location: src/wallet/test/coinselection_tests.cpp:320 (head).

Details and suggested fix

The direct SelectCoinsSRD call immediately uses result-> without checking success. If a tie-break regression causes eviction to discard the light coins needed to meet the target within 536 WU, SRD can return an error. util::Result::operator-> then calls value(), which asserts has_value(), before Boost can evaluate the input-count check. The regression is still detected, but the diagnostic points to result access rather than the failed selection scenario. Add BOOST_REQUIRE_MESSAGE(result, "Tie-break same effective value with lower weight") before the first dereference. This reports the intended failure and stops the test case safely; the old helper's nonfatal BOOST_CHECK_MESSAGE would still allow the assertion.


Coverage details