aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.h
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2021-10-28 13:46:19 -0400
committerCarl Dong <contact@carldong.me>2022-06-28 15:36:18 -0400
commit82f00de7a6a60cbc9ad0c6e1d0ffb1bc70c49af5 (patch)
tree1a034d8f11035bf508c82a9cac2c8d935c648d03 /src/txmempool.h
parentf1941e8bfd2eecc478c7660434b1ebf6a64095a0 (diff)
downloadbitcoin-82f00de7a6a60cbc9ad0c6e1d0ffb1bc70c49af5.tar.xz
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.
Diffstat (limited to 'src/txmempool.h')
-rw-r--r--src/txmempool.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/txmempool.h b/src/txmempool.h
index 32319ac181..d5d573b4f9 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -564,6 +564,8 @@ public:
using Options = kernel::MemPoolOptions;
+ const int64_t m_max_size_bytes;
+
/** Create a new CTxMemPool.
* Sanity checks will be off by default for performance, because otherwise
* accepting transactions becomes O(N^2) where N is the number of transactions
@@ -702,6 +704,9 @@ public:
* takes the fee rate to go back down all the way to 0. When the feerate
* would otherwise be half of this, it is set to 0 instead.
*/
+ CFeeRate GetMinFee() const {
+ return GetMinFee(m_max_size_bytes);
+ }
CFeeRate GetMinFee(size_t sizelimit) const;
/** Remove transactions from the mempool until its dynamic size is <= sizelimit.