SelectCoinsBnB marks its result as completed when it exhausts the search space before reaching TOTAL_TRIES. Only the incomplete case is checked in the unit tests (bnb_exhaustion_with_solution_test), and the bnb_finds_min_waste fuzz target only reads the flag to decide whether to assert optimality, so reporting false goes unnoticed.
This PR checks GetAlgoCompleted() in TestBnBSuccess for cases that finish below the attempt limit (100,000).
Kills the following mutant (https://mutanthub.space/mutants/1096):
--- a/src/wallet/coinselection.cpp
+++ b/src/wallet/coinselection.cpp
@@ -233,7 +233,7 @@ util::Result<SelectionResult> SelectCoinsBnB(std::vector<OutputGroup>& utxo_pool
if (curr_selection.empty()) {
// Exhausted search space before running into attempt limit
is_done = true;
- result.SetAlgoCompleted(true);
+ result.SetAlgoCompleted(false);
break;
}
// Set `next_utxo` to one after last selected, then deselect last selected UTXO