Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 742 Lines • ▼ Show 20 Lines | void CTxMemPool::_clear() { | ||||
++nTransactionsUpdated; | ++nTransactionsUpdated; | ||||
} | } | ||||
void CTxMemPool::clear() { | void CTxMemPool::clear() { | ||||
LOCK(cs); | LOCK(cs); | ||||
_clear(); | _clear(); | ||||
} | } | ||||
void CTxMemPool::check(CChainState &active_chainstate) const { | void CTxMemPool::check(const CCoinsViewCache &active_coins_tip, | ||||
int64_t spendheight) const { | |||||
if (m_check_ratio == 0) { | if (m_check_ratio == 0) { | ||||
return; | return; | ||||
} | } | ||||
if (GetRand(m_check_ratio) >= 1) { | if (GetRand(m_check_ratio) >= 1) { | ||||
return; | return; | ||||
} | } | ||||
AssertLockHeld(::cs_main); | AssertLockHeld(::cs_main); | ||||
LOCK(cs); | LOCK(cs); | ||||
LogPrint(BCLog::MEMPOOL, | LogPrint(BCLog::MEMPOOL, | ||||
"Checking mempool with %u transactions and %u inputs\n", | "Checking mempool with %u transactions and %u inputs\n", | ||||
(unsigned int)mapTx.size(), (unsigned int)mapNextTx.size()); | (unsigned int)mapTx.size(), (unsigned int)mapNextTx.size()); | ||||
uint64_t checkTotal = 0; | uint64_t checkTotal = 0; | ||||
Amount check_total_fee{Amount::zero()}; | Amount check_total_fee{Amount::zero()}; | ||||
uint64_t innerUsage = 0; | uint64_t innerUsage = 0; | ||||
uint64_t prev_ancestor_count{0}; | uint64_t prev_ancestor_count{0}; | ||||
CCoinsViewCache &active_coins_tip = active_chainstate.CoinsTip(); | |||||
CCoinsViewCache mempoolDuplicate( | CCoinsViewCache mempoolDuplicate( | ||||
const_cast<CCoinsViewCache *>(&active_coins_tip)); | const_cast<CCoinsViewCache *>(&active_coins_tip)); | ||||
const int64_t spendheight = active_chainstate.m_chain.Height() + 1; | |||||
for (const auto &it : GetSortedDepthAndScore()) { | for (const auto &it : GetSortedDepthAndScore()) { | ||||
checkTotal += it->GetTxSize(); | checkTotal += it->GetTxSize(); | ||||
check_total_fee += it->GetFee(); | check_total_fee += it->GetFee(); | ||||
innerUsage += it->DynamicMemoryUsage(); | innerUsage += it->DynamicMemoryUsage(); | ||||
const CTransaction &tx = it->GetTx(); | const CTransaction &tx = it->GetTx(); | ||||
innerUsage += memusage::DynamicUsage(it->GetMemPoolParentsConst()) + | innerUsage += memusage::DynamicUsage(it->GetMemPoolParentsConst()) + | ||||
memusage::DynamicUsage(it->GetMemPoolChildrenConst()); | memusage::DynamicUsage(it->GetMemPoolChildrenConst()); | ||||
▲ Show 20 Lines • Show All 716 Lines • Show Last 20 Lines |