mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
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:
@@ -29,8 +29,10 @@ static void GroupCoins(FuzzedDataProvider& fuzzed_data_provider, const std::vect
|
||||
auto output_group = OutputGroup(coin_params);
|
||||
bool valid_outputgroup{false};
|
||||
for (auto& coin : coins) {
|
||||
output_group.Insert(coin, /*ancestors=*/0, /*descendants=*/0, positive_only);
|
||||
// If positive_only was specified, nothing may have been inserted, leading to an empty output group
|
||||
if (!positive_only || (positive_only && coin.GetEffectiveValue() > 0)) {
|
||||
output_group.Insert(coin, /*ancestors=*/0, /*descendants=*/0);
|
||||
}
|
||||
// If positive_only was specified, nothing was inserted, leading to an empty output group
|
||||
// that would be invalid for the BnB algorithm
|
||||
valid_outputgroup = !positive_only || output_group.GetSelectionAmount() > 0;
|
||||
if (valid_outputgroup && fuzzed_data_provider.ConsumeBool()) {
|
||||
|
||||
Reference in New Issue
Block a user