diff --git a/src/wallet/coinselection.cpp b/src/wallet/coinselection.cpp index 6755376ff51..e671c3d091f 100644 --- a/src/wallet/coinselection.cpp +++ b/src/wallet/coinselection.cpp @@ -131,6 +131,7 @@ util::Result SelectCoinsBnB(std::vector& utxo_pool }; size_t curr_try = 0; + SelectionResult result(selection_target, SelectionAlgorithm::BNB); while (true) { bool should_shift{false}, should_cut{false}; // Select `next_utxo` @@ -166,6 +167,7 @@ util::Result SelectCoinsBnB(std::vector& utxo_pool if (curr_try >= TOTAL_TRIES) { // Solution is not guaranteed to be optimal if `curr_try` hit TOTAL_TRIES + result.SetAlgoCompleted(false); break; } @@ -185,6 +187,7 @@ util::Result SelectCoinsBnB(std::vector& utxo_pool if (should_shift) { if (curr_selection.empty()) { // Exhausted search space before running into attempt limit + result.SetAlgoCompleted(true); break; } // Set `next_utxo` to one after last selected, then deselect last selected UTXO @@ -193,7 +196,6 @@ util::Result SelectCoinsBnB(std::vector& utxo_pool } } - SelectionResult result(selection_target, SelectionAlgorithm::BNB); result.SetSelectionsEvaluated(curr_try); if (best_selection.empty()) {