mempool: Remove unused function CalculateDescendantMaximum
What changed, and why it matters
This commit simply deletes a private helper function called CalculateDescendantMaximum from Bitcoin Core's memory pool code because nothing in the program was using it anymore. It is a routine cleanup change with no visible security effect.
No action needed; this is a benign dead-code removal.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch removes the CTxMemPool::CalculateDescendantMaximum(txiter) method and its declaration. The function walked an entry’s ancestor chain to find the highest descendant count, but it had no callers. Two related methods, CalculateAncestorData and CalculateDescendantData, remain and are unchanged. No logic, locking, or behavior changes are introduced.
Changed components
src/txmempool.cppsrc/txmempool.hInspect captured patch +0 / −24
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index e268fd61..7c3be6e1 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -1165,28 +1165,6 @@ void CTxMemPool::TrimToSize(size_t sizelimit, std::vector<COutPoint>* pvNoSpends
}
}
-uint64_t CTxMemPool::CalculateDescendantMaximum(txiter entry) const {
- // find parent with highest descendant count
- std::vector<txiter> candidates;
- setEntries counted;
- candidates.push_back(entry);
- uint64_t maximum = 0;
- while (candidates.size()) {
- txiter candidate = candidates.back();
- candidates.pop_back();
- if (!counted.insert(candidate).second) continue;
- const CTxMemPoolEntry::Parents& parents = candidate->GetMemPoolParentsConst();
- if (parents.size() == 0) {
- maximum = std::max(maximum, candidate->GetCountWithDescendants());
- } else {
- for (const CTxMemPoolEntry& i : parents) {
- candidates.push_back(mapTx.iterator_to(i));
- }
- }
- }
- return maximum;
-}
-
std::tuple<size_t, size_t, CAmount> CTxMemPool::CalculateAncestorData(const CTxMemPoolEntry& entry) const
{
auto ancestors = m_txgraph->GetAncestors(entry, TxGraph::Level::MAIN);
diff --git a/src/txmempool.h b/src/txmempool.h
index 520410b6..054d9e12 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -284,8 +284,6 @@ public:
using Limits = kernel::MemPoolLimits;
- uint64_t CalculateDescendantMaximum(txiter entry) const EXCLUSIVE_LOCKS_REQUIRED(cs);
-
std::tuple<size_t, size_t, CAmount> CalculateAncestorData(const CTxMemPoolEntry& entry) const EXCLUSIVE_LOCKS_REQUIRED(cs);
std::tuple<size_t, size_t, CAmount> CalculateDescendantData(const CTxMemPoolEntry& entry) const EXCLUSIVE_LOCKS_REQUIRED(cs);
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.