diff options
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r-- | src/txmempool.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 52d223656b..4f740b7c0a 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -1066,6 +1066,16 @@ uint64_t CTxMemPool::CalculateDescendantMaximum(txiter entry) const { return top->GetCountWithDescendants(); } +void CTxMemPool::GetTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants) const { + LOCK(cs); + auto it = mapTx.find(txid); + ancestors = descendants = 0; + if (it != mapTx.end()) { + ancestors = it->GetCountWithAncestors(); + descendants = CalculateDescendantMaximum(it); + } +} + bool CTxMemPool::TransactionWithinChainLimit(const uint256& txid, size_t ancestor_limit, size_t descendant_limit) const { LOCK(cs); auto it = mapTx.find(txid); |