| 1049 | } |
| 1050 | |
| 1051 | uint64_t CTxMemPool::CalculateDescendantMaximum(txiter entry) const { |
| 1052 | // find parent with highest descendant count |
| 1053 | std::vector<txiter> candidates; |
| 1054 | setEntries counted; |
| 1055 | candidates.push_back(entry); |
| 1056 | uint64_t maximum = 0; |
| 1057 | while (candidates.size()) { |
| 1058 | txiter candidate = candidates.back(); |
| 1059 | candidates.pop_back(); |
| 1060 | if (!counted.insert(candidate).second) continue; |
| 1061 | const setEntries& parents = GetMemPoolParents(candidate); |
| 1062 | if (parents.size() == 0) { |
| 1063 | maximum = std::max(maximum, candidate->GetCountWithDescendants()); |
| 1064 | } else { |
| 1065 | for (txiter i : parents) { |
| 1066 | candidates.push_back(i); |
| 1067 | } |
| 1068 | } |
| 1069 | } |
| 1070 | return maximum; |
| 1071 | } |
| 1072 | |
| 1073 | void CTxMemPool::GetTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants) const { |
| 1074 | LOCK(cs); |