1 suggestion
Optional improvements
[suggestion] · The new test passes even if the overweight filter is deleted
This unit test would still pass without the overweight filter because only the light group matches the target, leaving exclusion of overweight groups unchecked.
Location: src/wallet/test/coinselection_tests.cpp:272 (head).
Details and suggested fix
MakeCoin gives the heavy groups an effective value of 5 * CENT, so without the weight filter they only populate lowest_larger. The light 1 * CENT group still takes the exact-match return, satisfying both assertions. Make the heavy groups exact matches using MakeCoin(1 * CENT, true, default_cs_params, P2WPKH_INPUT_VSIZE + 1) and add BOOST_CHECK(result->GetWeight() <= max_selection_weight). Correct code would still select only the light group. With the filter deleted, a heavy group shuffled before it would return an overweight result and fail the new assertion. This retains the repeated-shuffle coverage of the continue-to-break mutation. The fuzz target already asserts selected weight, but the change would make this unit case check exclusion as well as continued scanning.