wallet: make OutputGroup "positive_only" filter explicit

And not hide it inside the `OutputGroup::Insert` method.
This method does not return anything if insertion fails.

We can know before calling `Insert` whether the coin
will be accepted or not.
This commit is contained in:
furszy
2022-07-31 17:22:04 -03:00
parent 3b88c85025
commit 06ec8f9928
6 changed files with 20 additions and 18 deletions

View File

@@ -333,10 +333,7 @@ std::optional<SelectionResult> KnapsackSolver(std::vector<OutputGroup>& groups,
******************************************************************************/
void OutputGroup::Insert(const COutput& output, size_t ancestors, size_t descendants, bool positive_only) {
// Filter for positive only here before adding the coin
if (positive_only && output.GetEffectiveValue() <= 0) return;
void OutputGroup::Insert(const COutput& output, size_t ancestors, size_t descendants) {
m_outputs.push_back(output);
COutput& coin = m_outputs.back();