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

@@ -53,7 +53,7 @@ static void add_coin(const CAmount& nValue, int nInput, SelectionResult& result)
tx.nLockTime = nextLockTime++; // so all transactions get different hashes
COutput output(COutPoint(tx.GetHash(), nInput), tx.vout.at(nInput), /*depth=*/ 1, /*input_bytes=*/ -1, /*spendable=*/ true, /*solvable=*/ true, /*safe=*/ true, /*time=*/ 0, /*from_me=*/ false, /*fees=*/ 0);
OutputGroup group;
group.Insert(output, /*ancestors=*/ 0, /*descendants=*/ 0, /*positive_only=*/ true);
group.Insert(output, /*ancestors=*/ 0, /*descendants=*/ 0);
result.AddInput(group);
}
@@ -134,7 +134,7 @@ inline std::vector<OutputGroup>& GroupCoins(const std::vector<COutput>& availabl
static_groups.clear();
for (auto& coin : available_coins) {
static_groups.emplace_back();
static_groups.back().Insert(coin, /*ancestors=*/ 0, /*descendants=*/ 0, /*positive_only=*/ false);
static_groups.back().Insert(coin, /*ancestors=*/ 0, /*descendants=*/ 0);
}
return static_groups;
}