mempool: Pass in -maxmempool instead of referencing gArgs

- Store the mempool size limit (-maxmempool) in CTxMemPool as a member.

- Remove the requirement to explicitly specify a mempool size limit for
  CTxMemPool::GetMinFee(...) and LimitMempoolSize(...), just use the
  stored mempool size limit where possible.

- Remove all now-unnecessary instances of:
    gArgs.GetIntArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE_MB) * 1000000

The code change in CChainState::GetCoinsCacheSizeState() is correct
since the coinscache should not repurpose "extra" mempool memory
headroom for itself if the mempool doesn't even exist.
This commit is contained in:
Carl Dong
2021-10-28 13:46:19 -04:00
parent f1941e8bfd
commit 82f00de7a6
10 changed files with 25 additions and 16 deletions

View File

@@ -453,7 +453,8 @@ void CTxMemPoolEntry::UpdateAncestorState(int64_t modifySize, CAmount modifyFee,
CTxMemPool::CTxMemPool(const Options& opts)
: m_check_ratio{opts.check_ratio},
minerPolicyEstimator{opts.estimator}
minerPolicyEstimator{opts.estimator},
m_max_size_bytes{opts.max_size_bytes}
{
_clear(); //lock free clear
}