Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 776 Lines • ▼ Show 20 Lines | for (indexed_transaction_set::const_iterator it = mapTx.begin(); | ||||
// Verify ancestor state is correct. | // Verify ancestor state is correct. | ||||
setEntries setAncestors; | setEntries setAncestors; | ||||
uint64_t nNoLimit = std::numeric_limits<uint64_t>::max(); | uint64_t nNoLimit = std::numeric_limits<uint64_t>::max(); | ||||
std::string dummy; | std::string dummy; | ||||
CalculateMemPoolAncestors(*it, setAncestors, nNoLimit, nNoLimit, | CalculateMemPoolAncestors(*it, setAncestors, nNoLimit, nNoLimit, | ||||
nNoLimit, nNoLimit, dummy); | nNoLimit, nNoLimit, dummy); | ||||
uint64_t nCountCheck = setAncestors.size() + 1; | uint64_t nCountCheck = setAncestors.size() + 1; | ||||
uint64_t nSizeCheck = it->GetTxSize(); | uint64_t nSizeCheck = it->GetTxSize(); | ||||
uint64_t nBillableSizeCheck = it->GetTxBillableSize(); | |||||
Amount nFeesCheck = it->GetModifiedFee(); | Amount nFeesCheck = it->GetModifiedFee(); | ||||
int64_t nSigOpCheck = it->GetSigOpCount(); | int64_t nSigOpCheck = it->GetSigOpCount(); | ||||
for (txiter ancestorIt : setAncestors) { | for (txiter ancestorIt : setAncestors) { | ||||
nSizeCheck += ancestorIt->GetTxSize(); | nSizeCheck += ancestorIt->GetTxSize(); | ||||
nBillableSizeCheck += ancestorIt->GetTxBillableSize(); | |||||
nFeesCheck += ancestorIt->GetModifiedFee(); | nFeesCheck += ancestorIt->GetModifiedFee(); | ||||
nSigOpCheck += ancestorIt->GetSigOpCount(); | nSigOpCheck += ancestorIt->GetSigOpCount(); | ||||
} | } | ||||
assert(it->GetCountWithAncestors() == nCountCheck); | assert(it->GetCountWithAncestors() == nCountCheck); | ||||
assert(it->GetSizeWithAncestors() == nSizeCheck); | assert(it->GetSizeWithAncestors() == nSizeCheck); | ||||
assert(it->GetBillableSizeWithAncestors() == nBillableSizeCheck); | |||||
assert(it->GetSigOpCountWithAncestors() == nSigOpCheck); | assert(it->GetSigOpCountWithAncestors() == nSigOpCheck); | ||||
assert(it->GetModFeesWithAncestors() == nFeesCheck); | assert(it->GetModFeesWithAncestors() == nFeesCheck); | ||||
// Check children against mapNextTx | // Check children against mapNextTx | ||||
CTxMemPool::setEntries setChildrenCheck; | CTxMemPool::setEntries setChildrenCheck; | ||||
auto iter = mapNextTx.lower_bound(COutPoint(it->GetTx().GetId(), 0)); | auto iter = mapNextTx.lower_bound(COutPoint(it->GetTx().GetId(), 0)); | ||||
int64_t childSizes = 0; | int64_t childSizes = 0; | ||||
for (; iter != mapNextTx.end() && | for (; iter != mapNextTx.end() && | ||||
▲ Show 20 Lines • Show All 437 Lines • ▼ Show 20 Lines | while (!mapTx.empty() && DynamicMemoryUsage() > sizelimit) { | ||||
mapTx.get<descendant_score>().begin(); | mapTx.get<descendant_score>().begin(); | ||||
// We set the new mempool min fee to the feerate of the removed set, | // We set the new mempool min fee to the feerate of the removed set, | ||||
// plus the "minimum reasonable fee rate" (ie some value under which we | // plus the "minimum reasonable fee rate" (ie some value under which we | ||||
// consider txn to have 0 fee). This way, we don't allow txn to enter | // consider txn to have 0 fee). This way, we don't allow txn to enter | ||||
// mempool with feerate equal to txn which were removed with no block in | // mempool with feerate equal to txn which were removed with no block in | ||||
// between. | // between. | ||||
CFeeRate removed(it->GetModFeesWithDescendants(), | CFeeRate removed(it->GetModFeesWithDescendants(), | ||||
it->GetSizeWithDescendants()); | it->GetBillableSizeWithDescendants()); | ||||
removed += MEMPOOL_FULL_FEE_INCREMENT; | removed += MEMPOOL_FULL_FEE_INCREMENT; | ||||
trackPackageRemoved(removed); | trackPackageRemoved(removed); | ||||
maxFeeRateRemoved = std::max(maxFeeRateRemoved, removed); | maxFeeRateRemoved = std::max(maxFeeRateRemoved, removed); | ||||
setEntries stage; | setEntries stage; | ||||
CalculateDescendants(mapTx.project<0>(it), stage); | CalculateDescendants(mapTx.project<0>(it), stage); | ||||
nTxnRemoved += stage.size(); | nTxnRemoved += stage.size(); | ||||
▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines |