In dc5e20cf97f87fa9a37aeea76a480e412c49834c “[doc] coin selection filters by max cluster count, not descendant”
The following remaining places within GroupOutputs seems appropriate to be updated in this commit because getTransactionAncestry and OutputGroup.Insert() accept cluster_count now.
Based on the tone in the PR description, I’m not certain if it was intentional to skip these changes.
0diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
1index 59c6ab116c..e2e2403a99 100644
2--- a/src/wallet/spend.cpp
3+++ b/src/wallet/spend.cpp
4@@ -583,12 +583,12 @@ FilteredOutputGroups GroupOutputs(const CWallet& wallet,
5 for (const auto& [type, outputs] : coins.coins) {
6 for (const COutput& output : outputs) {
7 // Get mempool info
8- size_t ancestors, descendants;
9- wallet.chain().getTransactionAncestry(output.outpoint.hash, ancestors, descendants);
10+ size_t ancestors, cluster_count;
11+ wallet.chain().getTransactionAncestry(output.outpoint.hash, ancestors, cluster_count);
12
13 // Create a new group per output and add it to the all groups vector
14 OutputGroup group(coin_sel_params);
15- group.Insert(std::make_shared<COutput>(output), ancestors, descendants);
16+ group.Insert(std::make_shared<COutput>(output), ancestors, cluster_count);
17
18 // Each filter maps to a different set of groups
19 bool accepted = false;
20@@ -612,7 +612,7 @@ FilteredOutputGroups GroupOutputs(const CWallet& wallet,
21 // OUTPUT_GROUP_MAX_ENTRIES COutputs, a new OutputGroup is added to the end of the vector.
22 typedef std::map<std::pair<CScript, OutputType>, std::vector<OutputGroup>> ScriptPubKeyToOutgroup;
23 const auto& insert_output = [&](
24- const std::shared_ptr<COutput>& output, OutputType type, size_t ancestors, size_t descendants,
25+ const std::shared_ptr<COutput>& output, OutputType type, size_t ancestors, size_t cluster_count,
26 ScriptPubKeyToOutgroup& groups_map) {
27 std::vector<OutputGroup>& groups = groups_map[std::make_pair(output->txout.scriptPubKey,type)];
28
29@@ -633,24 +633,24 @@ FilteredOutputGroups GroupOutputs(const CWallet& wallet,
30 group = &groups.back();
31 }
32
33- group->Insert(output, ancestors, descendants);
34+ group->Insert(output, ancestors, cluster_count);
35 };
36
37 ScriptPubKeyToOutgroup spk_to_groups_map;
38 ScriptPubKeyToOutgroup spk_to_positive_groups_map;
39 for (const auto& [type, outs] : coins.coins) {
40 for (const COutput& output : outs) {
41- size_t ancestors, descendants;
42- wallet.chain().getTransactionAncestry(output.outpoint.hash, ancestors, descendants);
43+ size_t ancestors, cluster_count;
44+ wallet.chain().getTransactionAncestry(output.outpoint.hash, ancestors, cluster_count);
45
46 const auto& shared_output = std::make_shared<COutput>(output);
47 // Filter for positive only before adding the output
48 if (output.GetEffectiveValue() > 0) {
49- insert_output(shared_output, type, ancestors, descendants, spk_to_positive_groups_map);
50+ insert_output(shared_output, type, ancestors, cluster_count, spk_to_positive_groups_map);
51 }
52
53 // 'All' groups
54- insert_output(shared_output, type, ancestors, descendants, spk_to_groups_map);
55+ insert_output(shared_output, type, ancestors, cluster_count, spk_to_groups_map);
56 }
57 }
58