[refactor] rename variable to clarify it is unused and cluster count
What changed, and why it matters
This commit is a simple code cleanup: it renames a local variable from 'descendant_count' to 'unused_cluster_count' in two wallet files to make clear that the value is not actually used. There is no functional change, no bug fix, and no security relevance.
No action needed; this is a non-functional refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change renames the second output parameter of getTransactionAncestry() calls in src/wallet/rpc/coins.cpp and src/wallet/spend.cpp. The variable was previously named ‘descendant_count’ but the underlying value represents a cluster count that the caller ignores. The rename clarifies intent without altering behavior.
Changed components
src/wallet/rpc/coins.cppsrc/wallet/spend.cppInspect captured patch +4 / −4
diff --git a/src/wallet/rpc/coins.cpp b/src/wallet/rpc/coins.cpp
index 5dc3391d..1cf586ad 100644
--- a/src/wallet/rpc/coins.cpp
+++ b/src/wallet/rpc/coins.cpp
@@ -663,9 +663,9 @@ RPCHelpMan listunspent()
entry.pushKV("amount", ValueFromAmount(out.txout.nValue));
entry.pushKV("confirmations", out.depth);
if (!out.depth) {
- size_t ancestor_count, descendant_count, ancestor_size;
+ size_t ancestor_count, unused_cluster_count, ancestor_size;
CAmount ancestor_fees;
- pwallet->chain().getTransactionAncestry(out.outpoint.hash, ancestor_count, descendant_count, &ancestor_size, &ancestor_fees);
+ pwallet->chain().getTransactionAncestry(out.outpoint.hash, ancestor_count, unused_cluster_count, &ancestor_size, &ancestor_fees);
if (ancestor_count) {
entry.pushKV("ancestorcount", ancestor_count);
entry.pushKV("ancestorsize", ancestor_size);
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index edde9234..c91d0f47 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -405,8 +405,8 @@ CoinsResult AvailableCoins(const CWallet& wallet,
if (wtx.truc_child_in_mempool.has_value()) continue;
// this unconfirmed v3 transaction has a parent: spending would create a third generation
- size_t ancestors, descendants;
- wallet.chain().getTransactionAncestry(wtx.tx->GetHash(), ancestors, descendants);
+ size_t ancestors, unused_cluster_count;
+ wallet.chain().getTransactionAncestry(wtx.tx->GetHash(), ancestors, unused_cluster_count);
if (ancestors > 1) continue;
} else {
if (wtx.tx->version == TRUC_VERSION) continue;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.