File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1066,6 +1066,16 @@ uint64_t CTxMemPool::CalculateDescendantMaximum(txiter entry) const {
1066
1066
return top->GetCountWithDescendants ();
1067
1067
}
1068
1068
1069
+ void CTxMemPool::GetTransactionAncestry (const uint256& txid, size_t & ancestors, size_t & descendants) const {
1070
+ LOCK (cs);
1071
+ auto it = mapTx.find (txid);
1072
+ ancestors = descendants = 0 ;
1073
+ if (it != mapTx.end ()) {
1074
+ ancestors = it->GetCountWithAncestors ();
1075
+ descendants = CalculateDescendantMaximum (it);
1076
+ }
1077
+ }
1078
+
1069
1079
bool CTxMemPool::TransactionWithinChainLimit (const uint256& txid, size_t ancestor_limit, size_t descendant_limit) const {
1070
1080
LOCK (cs);
1071
1081
auto it = mapTx.find (txid);
Original file line number Diff line number Diff line change @@ -620,6 +620,12 @@ class CTxMemPool
620
620
/* * Expire all transaction (and their dependencies) in the mempool older than time. Return the number of removed transactions. */
621
621
int Expire (int64_t time);
622
622
623
+ /* *
624
+ * Calculate the ancestor and descendant count for the given transaction.
625
+ * The counts include the transaction itself.
626
+ */
627
+ void GetTransactionAncestry (const uint256& txid, size_t & ancestors, size_t & descendants) const ;
628
+
623
629
/* * Returns false if the transaction is in the mempool and not within the chain limit specified. */
624
630
bool TransactionWithinChainLimit (const uint256& txid, size_t ancestor_limit, size_t descendant_limit) const ;
625
631
You can’t perform that action at this time.
0 commit comments