Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | void CTxMemPool::UpdateTransactionsFromBlock( | ||||
// descendants when we come across a previously seen entry. | // descendants when we come across a previously seen entry. | ||||
cacheMap mapMemPoolDescendantsToUpdate; | cacheMap mapMemPoolDescendantsToUpdate; | ||||
// Use a set for lookups into txidsToUpdate (these entries are already | // Use a set for lookups into txidsToUpdate (these entries are already | ||||
// accounted for in the state of their ancestors) | // accounted for in the state of their ancestors) | ||||
std::set<TxId> setAlreadyIncluded(txidsToUpdate.begin(), | std::set<TxId> setAlreadyIncluded(txidsToUpdate.begin(), | ||||
txidsToUpdate.end()); | txidsToUpdate.end()); | ||||
// Iterate in reverse, so that whenever we are looking at at a transaction | // Iterate in reverse, so that whenever we are looking at a transaction | ||||
// we are sure that all in-mempool descendants have already been processed. | // we are sure that all in-mempool descendants have already been processed. | ||||
// This maximizes the benefit of the descendant cache and guarantees that | // This maximizes the benefit of the descendant cache and guarantees that | ||||
// setMemPoolChildren will be updated, an assumption made in | // setMemPoolChildren will be updated, an assumption made in | ||||
// UpdateForDescendants. | // UpdateForDescendants. | ||||
for (const TxId &txid : reverse_iterate(txidsToUpdate)) { | for (const TxId &txid : reverse_iterate(txidsToUpdate)) { | ||||
// we cache the in-mempool children to avoid duplicate updates | // we cache the in-mempool children to avoid duplicate updates | ||||
setEntries setChildren; | setEntries setChildren; | ||||
// calculate children from mapNextTx | // calculate children from mapNextTx | ||||
▲ Show 20 Lines • Show All 1,234 Lines • Show Last 20 Lines |