@@ -444,10 +444,9 @@ FilteredOutputGroups GroupOutputs(const CWallet& wallet,
444
444
// to the last OutputGroup in the vector for the scriptPubKey. When the last OutputGroup has
445
445
// OUTPUT_GROUP_MAX_ENTRIES COutputs, a new OutputGroup is added to the end of the vector.
446
446
typedef std::map<std::pair<CScript, OutputType>, std::vector<OutputGroup>> ScriptPubKeyToOutgroup;
447
- const auto & group_outputs = [](
447
+ const auto & insert_output = [& ](
448
448
const std::shared_ptr<COutput>& output, OutputType type, size_t ancestors, size_t descendants,
449
- ScriptPubKeyToOutgroup& groups_map, const CoinSelectionParams& coin_sel_params,
450
- bool positive_only) {
449
+ ScriptPubKeyToOutgroup& groups_map) {
451
450
std::vector<OutputGroup>& groups = groups_map[std::make_pair (output->txout .scriptPubKey ,type)];
452
451
453
452
if (groups.size () == 0 ) {
@@ -467,10 +466,7 @@ FilteredOutputGroups GroupOutputs(const CWallet& wallet,
467
466
group = &groups.back ();
468
467
}
469
468
470
- // Filter for positive only before adding the output to group
471
- if (!positive_only || output->GetEffectiveValue () > 0 ) {
472
- group->Insert (output, ancestors, descendants);
473
- }
469
+ group->Insert (output, ancestors, descendants);
474
470
};
475
471
476
472
ScriptPubKeyToOutgroup spk_to_groups_map;
@@ -484,9 +480,13 @@ FilteredOutputGroups GroupOutputs(const CWallet& wallet,
484
480
wallet.chain ().getTransactionAncestry (output.outpoint .hash , ancestors, descendants);
485
481
486
482
const auto & shared_output = std::make_shared<COutput>(output);
487
- group_outputs (shared_output, type, ancestors, descendants, spk_to_groups_map, coin_sel_params, /* positive_only=*/ false );
488
- group_outputs (shared_output, type, ancestors, descendants, spk_to_positive_groups_map,
489
- coin_sel_params, /* positive_only=*/ true );
483
+ // Filter for positive only before adding the output
484
+ if (output.GetEffectiveValue () > 0 ) {
485
+ insert_output (shared_output, type, ancestors, descendants, spk_to_positive_groups_map);
486
+ }
487
+
488
+ // 'All' groups
489
+ insert_output (shared_output, type, ancestors, descendants, spk_to_groups_map);
490
490
}
491
491
}
492
492
0 commit comments