MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / CalculateDescendantMaximum

Method CalculateDescendantMaximum

src/txmempool.cpp:1051–1071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1049}
1050
1051uint64_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
1073void CTxMemPool::GetTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants) const {
1074 LOCK(cs);

Callers

nothing calls this directly

Calls 6

maxFunction · 0.85
push_backMethod · 0.45
sizeMethod · 0.45
pop_backMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected