mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 06:43:45 +01:00
refactor: no mempool arg to GetCoinsCacheSizeState
Unnecessary argument since we can make use of this->m_mempool Co-authored-by: John Newbery <john@johnnewbery.com>
This commit is contained in:
@@ -1998,20 +1998,18 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
||||
return true;
|
||||
}
|
||||
|
||||
CoinsCacheSizeState CChainState::GetCoinsCacheSizeState(const CTxMemPool* tx_pool)
|
||||
CoinsCacheSizeState CChainState::GetCoinsCacheSizeState()
|
||||
{
|
||||
return this->GetCoinsCacheSizeState(
|
||||
tx_pool,
|
||||
m_coinstip_cache_size_bytes,
|
||||
gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000);
|
||||
}
|
||||
|
||||
CoinsCacheSizeState CChainState::GetCoinsCacheSizeState(
|
||||
const CTxMemPool* tx_pool,
|
||||
size_t max_coins_cache_size_bytes,
|
||||
size_t max_mempool_size_bytes)
|
||||
{
|
||||
const int64_t nMempoolUsage = tx_pool ? tx_pool->DynamicMemoryUsage() : 0;
|
||||
const int64_t nMempoolUsage = m_mempool ? m_mempool->DynamicMemoryUsage() : 0;
|
||||
int64_t cacheSize = CoinsTip().DynamicMemoryUsage();
|
||||
int64_t nTotalSpace =
|
||||
max_coins_cache_size_bytes + std::max<int64_t>(max_mempool_size_bytes - nMempoolUsage, 0);
|
||||
@@ -2050,7 +2048,7 @@ bool CChainState::FlushStateToDisk(
|
||||
bool fFlushForPrune = false;
|
||||
bool fDoFullFlush = false;
|
||||
|
||||
CoinsCacheSizeState cache_state = GetCoinsCacheSizeState(m_mempool);
|
||||
CoinsCacheSizeState cache_state = GetCoinsCacheSizeState();
|
||||
LOCK(cs_LastBlockFile);
|
||||
if (fPruneMode && (fCheckForPruning || nManualPruneHeight > 0) && !fReindex) {
|
||||
// make sure we don't prune above the blockfilterindexes bestblocks
|
||||
@@ -4885,7 +4883,7 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
|
||||
}
|
||||
|
||||
const auto snapshot_cache_state = WITH_LOCK(::cs_main,
|
||||
return snapshot_chainstate.GetCoinsCacheSizeState(snapshot_chainstate.m_mempool));
|
||||
return snapshot_chainstate.GetCoinsCacheSizeState());
|
||||
|
||||
if (snapshot_cache_state >=
|
||||
CoinsCacheSizeState::CRITICAL) {
|
||||
|
||||
Reference in New Issue
Block a user