wallet: Replace max descendant count with cluster_count

With the descendant size limits removed, replace the concept of "max number of
descendants of any ancestor of a given tx" with the cluster count of the cluster
that the transaction belongs to.
This commit is contained in:
Suhas Daftuar
2023-10-03 15:00:00 -04:00
parent e031085fd4
commit 8e49477e86
4 changed files with 70 additions and 70 deletions

View File

@@ -1217,16 +1217,16 @@ std::tuple<size_t, size_t, CAmount> CTxMemPool::CalculateDescendantData(const CT
return {descendant_count, descendant_size, descendant_fees};
}
void CTxMemPool::GetTransactionAncestry(const Txid& txid, size_t& ancestors, size_t& descendants, size_t* const ancestorsize, CAmount* const ancestorfees) const {
void CTxMemPool::GetTransactionAncestry(const Txid& txid, size_t& ancestors, size_t& cluster_count, size_t* const ancestorsize, CAmount* const ancestorfees) const {
LOCK(cs);
auto it = mapTx.find(txid);
ancestors = descendants = 0;
ancestors = cluster_count = 0;
if (it != mapTx.end()) {
auto [ancestor_count, ancestor_size, ancestor_fees] = CalculateAncestorData(*it);
descendants = CalculateDescendantMaximum(it);
ancestors = ancestor_count;
if (ancestorsize) *ancestorsize = ancestor_size;
if (ancestorfees) *ancestorfees = ancestor_fees;
cluster_count = m_txgraph->GetCluster(*it, TxGraph::Level::MAIN).size();
}
}