mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Merge b09ad737ee into merged_master (Bitcoin PR #20944)
This commit is contained in:
commit
77f846938e
5 changed files with 32 additions and 14 deletions
|
|
@ -11,14 +11,14 @@
|
|||
#include <consensus/validation.h>
|
||||
#include <optional.h>
|
||||
#include <pegins.h>
|
||||
#include <validation.h>
|
||||
#include <policy/policy.h>
|
||||
#include <policy/fees.h>
|
||||
#include <policy/policy.h>
|
||||
#include <policy/settings.h>
|
||||
#include <reverse_iterator.h>
|
||||
#include <util/system.h>
|
||||
#include <util/moneystr.h>
|
||||
#include <util/system.h>
|
||||
#include <util/time.h>
|
||||
#include <validation.h>
|
||||
#include <validationinterface.h>
|
||||
|
||||
CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& _tx, const CAmount& _nFee,
|
||||
|
|
@ -399,7 +399,10 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces
|
|||
|
||||
nTransactionsUpdated++;
|
||||
totalTxSize += entry.GetTxSize();
|
||||
if (minerPolicyEstimator) {minerPolicyEstimator->processTransaction(entry, validFeeEstimate);}
|
||||
m_total_fee += entry.GetFee();
|
||||
if (minerPolicyEstimator) {
|
||||
minerPolicyEstimator->processTransaction(entry, validFeeEstimate);
|
||||
}
|
||||
|
||||
vTxHashes.emplace_back(tx.GetWitnessHash(), newit);
|
||||
newit->vTxHashesIdx = vTxHashes.size() - 1;
|
||||
|
|
@ -435,6 +438,7 @@ void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason)
|
|||
vTxHashes.clear();
|
||||
|
||||
totalTxSize -= it->GetTxSize();
|
||||
m_total_fee -= it->GetFee();
|
||||
cachedInnerUsage -= it->DynamicMemoryUsage();
|
||||
cachedInnerUsage -= memusage::DynamicUsage(it->GetMemPoolParentsConst()) + memusage::DynamicUsage(it->GetMemPoolChildrenConst());
|
||||
mapTx.erase(it);
|
||||
|
|
@ -646,6 +650,7 @@ void CTxMemPool::_clear()
|
|||
mapTx.clear();
|
||||
mapNextTx.clear();
|
||||
totalTxSize = 0;
|
||||
m_total_fee = 0;
|
||||
cachedInnerUsage = 0;
|
||||
lastRollingFeeUpdate = GetTime();
|
||||
blockSinceLastRollingFeeBump = false;
|
||||
|
|
@ -688,6 +693,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
|||
LogPrint(BCLog::MEMPOOL, "Checking mempool with %u transactions and %u inputs\n", (unsigned int)mapTx.size(), (unsigned int)mapNextTx.size());
|
||||
|
||||
uint64_t checkTotal = 0;
|
||||
CAmount check_total_fee{0};
|
||||
uint64_t innerUsage = 0;
|
||||
|
||||
CCoinsViewCache mempoolDuplicate(const_cast<CCoinsViewCache*>(pcoins));
|
||||
|
|
@ -700,6 +706,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
|||
for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {
|
||||
unsigned int i = 0;
|
||||
checkTotal += it->GetTxSize();
|
||||
check_total_fee += it->GetFee();
|
||||
innerUsage += it->DynamicMemoryUsage();
|
||||
const CTransaction& tx = it->GetTx();
|
||||
innerUsage += memusage::DynamicUsage(it->GetMemPoolParentsConst()) + memusage::DynamicUsage(it->GetMemPoolChildrenConst());
|
||||
|
|
@ -803,6 +810,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
|||
//
|
||||
|
||||
assert(totalTxSize == checkTotal);
|
||||
assert(m_total_fee == check_total_fee);
|
||||
assert(innerUsage == cachedInnerUsage);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue