This is part of the libbitcoinkernel project: #24303, https://github.com/bitcoin/bitcoin/projects/18
As mentioned in the Stage 1 Step 2 description of the libbitcoinkernel project, ArgsManager will not be part of libbitcoinkernel. Therefore, it is important that we remove any dependence on ArgsManager by code that will be part of libbitcoinkernel. This is the first in a series of PRs aiming to achieve this.
This PR removes CTxMemPool+MempoolAccept’s dependency on ArgsManager by introducing a CTxMemPool::Options struct, which is used to specify CTxMemPool’s various options at construction time.
These options are:
-maxmempool->CTxMemPool::Options::max_size-mempoolexpiry->CTxMemPool::Options::expiry-limitancestorcount->CTxMemPool::Options::limits::ancestor_count-limitancestorsize->CTxMemPool::Options::limits::ancestor_size-limitdescendantcount->CTxMemPool::Options::limits::descendant_count-limitdescendantsize->CTxMemPool::Options::limits::descendant_size
More context can be gleaned from the commit messages. The important commits are:
- 56eb479ded8bfb2ef635bb6f3b484f9d5952c70d “pool: Add and use MemPoolOptions, ApplyArgsManOptions”
- a1e08b70f3068f4e8def1c630d8f50cd54da7832 “mempool: Pass in -maxmempool instead of referencing gArgs”
- 6f4bf3ede5812b374828f08fc728ceded2f10024 “mempool: Pass in -mempoolexpiry instead of referencing gArgs”
- 5958a7fe4806599fc620ee8c1a881ca10fa2dd16 “mempool: Introduce (still-unused) MemPoolLimits”
Reviewers: Help needed in the following commits (see commit messages):
- a1e08b70f3068f4e8def1c630d8f50cd54da7832 “mempool: Pass in -maxmempool instead of referencing gArgs”
- 0695081a797e9a5d7787b78b0f8289dafcc6bff7 “node/ifaces: Use existing MemPoolLimits”
Note to Reviewers: There are perhaps an infinite number of ways to architect CTxMemPool::Options, the current one tries to keep it simple, usable, and flexible. I hope we don’t spend too much time arguing over the design here since that’s not the point. In the case that you’re 100% certain that a different design is strictly better than this one in every regard, please show us a fully-implemented branch.
TODO:
- Use the more ergonomic
CTxMemPool::Optionswhere appropriate - Doxygen comments for
ApplyArgsManOptions,MemPoolOptions
Questions for Reviewers:
- Should we use
std::chrono::secondsforCTxMemPool::Options::expiryandCTxMemPool::m_expiryinstead of anint64_t? Something else? (std::chrono::hours?) - Should I merge
CTxMemPool::LimitsinsideCTxMemPool::Options?