MCPcopy Create free account
hub / github.com/ElementsProject/elements / CalculateDescendantMaximum

Method CalculateDescendantMaximum

src/txmempool.cpp:1282–1302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1280}
1281
1282uint64_t CTxMemPool::CalculateDescendantMaximum(txiter entry) const {
1283 // find parent with highest descendant count
1284 std::vector<txiter> candidates;
1285 setEntries counted;
1286 candidates.push_back(entry);
1287 uint64_t maximum = 0;
1288 while (candidates.size()) {
1289 txiter candidate = candidates.back();
1290 candidates.pop_back();
1291 if (!counted.insert(candidate).second) continue;
1292 const CTxMemPoolEntry::Parents& parents = candidate->GetMemPoolParentsConst();
1293 if (parents.size() == 0) {
1294 maximum = std::max(maximum, candidate->GetCountWithDescendants());
1295 } else {
1296 for (const CTxMemPoolEntry& i : parents) {
1297 candidates.push_back(mapTx.iterator_to(i));
1298 }
1299 }
1300 }
1301 return maximum;
1302}
1303
1304void CTxMemPool::GetTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants, size_t* const ancestorsize, CAmount* const ancestorfees) const {
1305 LOCK(cs);

Callers

nothing calls this directly

Calls 5

push_backMethod · 0.45
sizeMethod · 0.45
pop_backMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected