[wallet] assert BnB internally calculated waste is the same as GetSelectionWaste()

These two implementations of waste calculation should never deviate.
Still keep the SelectCoinsBnB internal calculation because incremental
calculate-as-you-go is much more performant than calling
GetSelectionWaste() over and over again.
This commit is contained in:
glozow
2022-03-11 12:20:36 +00:00
parent ce1fabe545
commit ec7d73628a
2 changed files with 2 additions and 1 deletions

View File

@@ -163,6 +163,8 @@ std::optional<SelectionResult> SelectCoinsBnB(std::vector<OutputGroup>& utxo_poo
result.AddInput(utxo_pool.at(i));
}
}
result.ComputeAndSetWaste(CAmount{0});
assert(best_waste == result.GetWaste());
return result;
}