Expose ancestorsize and ancestorfees via getTransactionAncestry

This commit is contained in:
Luke Dashjr
2019-10-18 04:02:50 +00:00
parent 42af9596ce
commit 3f77dfdaf0
4 changed files with 9 additions and 5 deletions

View File

@@ -1116,12 +1116,14 @@ uint64_t CTxMemPool::CalculateDescendantMaximum(txiter entry) const {
return maximum;
}
void CTxMemPool::GetTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants) const {
void CTxMemPool::GetTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants, size_t* const ancestorsize, CAmount* const ancestorfees) const {
LOCK(cs);
auto it = mapTx.find(txid);
ancestors = descendants = 0;
if (it != mapTx.end()) {
ancestors = it->GetCountWithAncestors();
if (ancestorsize) *ancestorsize = it->GetSizeWithAncestors();
if (ancestorfees) *ancestorfees = it->GetModFeesWithAncestors();
descendants = CalculateDescendantMaximum(it);
}
}