@@ -445,10 +445,10 @@ FilteredOutputGroups GroupOutputs(const CWallet& wallet,
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
447
const auto & group_outputs = [](
448
- const COutput& output, OutputType type, size_t ancestors, size_t descendants,
448
+ const std::shared_ptr< COutput> & output, OutputType type, size_t ancestors, size_t descendants,
449
449
ScriptPubKeyToOutgroup& groups_map, const CoinSelectionParams& coin_sel_params,
450
450
bool positive_only) {
451
- std::vector<OutputGroup>& groups = groups_map[std::make_pair (output. txout .scriptPubKey ,type)];
451
+ std::vector<OutputGroup>& groups = groups_map[std::make_pair (output-> txout .scriptPubKey ,type)];
452
452
453
453
if (groups.size () == 0 ) {
454
454
// No OutputGroups for this scriptPubKey yet, add one
@@ -468,8 +468,8 @@ FilteredOutputGroups GroupOutputs(const CWallet& wallet,
468
468
}
469
469
470
470
// Filter for positive only before adding the output to group
471
- if (!positive_only || output. GetEffectiveValue () > 0 ) {
472
- group->Insert (std::make_shared<COutput>( output) , ancestors, descendants);
471
+ if (!positive_only || output-> GetEffectiveValue () > 0 ) {
472
+ group->Insert (output, ancestors, descendants);
473
473
}
474
474
};
475
475
@@ -483,8 +483,9 @@ FilteredOutputGroups GroupOutputs(const CWallet& wallet,
483
483
size_t ancestors, descendants;
484
484
wallet.chain ().getTransactionAncestry (output.outpoint .hash , ancestors, descendants);
485
485
486
- group_outputs (output, type, ancestors, descendants, spk_to_groups_map, coin_sel_params, /* positive_only=*/ false );
487
- group_outputs (output, type, ancestors, descendants, spk_to_positive_groups_map,
486
+ 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,
488
489
coin_sel_params, /* positive_only=*/ true );
489
490
}
490
491
}
0 commit comments