mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
Merge bitcoin/bitcoin#25290: [kernel 3a/n] Decouple CTxMemPool from ArgsManager
d1684beabefees: Pass in a filepath instead of referencing gArgs (Carl Dong)9a3d825c30init: Remove redundant -*mempool*, -limit* queries (Carl Dong)6c5c60c412mempool: Use m_limit for UpdateTransactionsFromBlock (Carl Dong)9e93b10301node/ifaces: Use existing MemPoolLimits (Carl Dong)38af2bcf35mempoolaccept: Use limits from mempool in constructor (Carl Dong)9333427014mempool: Introduce (still-unused) MemPoolLimits (Carl Dong)716bb5fbd3scripted-diff: Rename anc/desc size limit vars to indicate SI unit (Carl Dong)1ecc77321dscripted-diff: Rename DEFAULT_MEMPOOL_EXPIRY to indicate time unit (Carl Dong)aa9141cd81mempool: Pass in -mempoolexpiry instead of referencing gArgs (Carl Dong)51c7a41a5einit: Only determine maxmempool once (Carl Dong)386c9472c8mempool: Make GetMinFee() with custom size protected (Carl Dong)82f00de7a6mempool: Pass in -maxmempool instead of referencing gArgs (Carl Dong)f1941e8bfdpool: Add and use MemPoolOptions, ApplyArgsManOptions (Carl Dong)0199bd35bbfuzz/rbf: Add missing TestingSetup (Carl Dong)ccbaf546a6scripted-diff: Rename DEFAULT_MAX_MEMPOOL_SIZE to indicate SI unit (Carl Dong)fc02f77ca6ArgsMan: Add Get*Arg functions returning optional (Carl Dong) Pull request description: 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](https://github.com/bitcoin/bitcoin/issues/24303), `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: - [x] Use the more ergonomic `CTxMemPool::Options` where appropriate - [x] Doxygen comments for `ApplyArgsManOptions`, `MemPoolOptions` ----- Questions for Reviewers: 1. Should we use `std::chrono::seconds` for `CTxMemPool::Options::expiry` and `CTxMemPool::m_expiry` instead of an `int64_t`? Something else? (`std::chrono::hours`?) 2. Should I merge `CTxMemPool::Limits` inside `CTxMemPool::Options`? ACKs for top commit: MarcoFalke: ACKd1684beabe🍜 ryanofsky: Code review ACKd1684beabe. Just minor cleanups since last review, mostly switching to brace initialization Tree-SHA512: 2c138e52d69f61c263f1c3648f01c801338a8f576762c815f478ef5148b8b2f51e91ded5c1be915e678c0b14f6cfba894b82afec58d999d39a7bb7c914736e0b
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
"""Tests that a mempool transaction expires after a given timeout and that its
|
||||
children are removed as well.
|
||||
|
||||
Both the default expiry timeout defined by DEFAULT_MEMPOOL_EXPIRY and a user
|
||||
Both the default expiry timeout defined by DEFAULT_MEMPOOL_EXPIRY_HOURS and a user
|
||||
definable expiry timeout via the '-mempoolexpiry=<n>' command line argument
|
||||
(<n> is the timeout in hours) are tested.
|
||||
"""
|
||||
@@ -20,7 +20,7 @@ from test_framework.util import (
|
||||
)
|
||||
from test_framework.wallet import MiniWallet
|
||||
|
||||
DEFAULT_MEMPOOL_EXPIRY = 336 # hours
|
||||
DEFAULT_MEMPOOL_EXPIRY_HOURS = 336 # hours
|
||||
CUSTOM_MEMPOOL_EXPIRY = 10 # hours
|
||||
|
||||
|
||||
@@ -98,8 +98,8 @@ class MempoolExpiryTest(BitcoinTestFramework):
|
||||
|
||||
def run_test(self):
|
||||
self.log.info('Test default mempool expiry timeout of %d hours.' %
|
||||
DEFAULT_MEMPOOL_EXPIRY)
|
||||
self.test_transaction_expiry(DEFAULT_MEMPOOL_EXPIRY)
|
||||
DEFAULT_MEMPOOL_EXPIRY_HOURS)
|
||||
self.test_transaction_expiry(DEFAULT_MEMPOOL_EXPIRY_HOURS)
|
||||
|
||||
self.log.info('Test custom mempool expiry timeout of %d hours.' %
|
||||
CUSTOM_MEMPOOL_EXPIRY)
|
||||
|
||||
Reference in New Issue
Block a user