mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
Merge bitcoin/bitcoin#25487: [kernel 3b/n] Decouple {Dump,Load}Mempool from ArgsManager
cb3e9a1e3fMove {Load,Dump}Mempool to kernel namespace (Carl Dong)aa30676541Move DEFAULT_PERSIST_MEMPOOL out of libbitcoinkernel (Carl Dong)06b88ffb8aLoadMempool: Pass in load_path, stop using gArgs (Carl Dong)b857ac60d9test/fuzz: Invoke LoadMempool via CChainState (Carl Dong)b3267258b0Move FopenFn to fsbridge namespace (Carl Dong)ae1e8e3756mempool: Use NodeClock+friends for LoadMempool (Carl Dong)f9e8e5719fmempool: Improve comments for [GS]etLoadTried (Carl Dong)813962da0bscripted-diff: Rename m_is_loaded -> m_load_tried (Carl Dong)413f4bb52bDumpMempool: Pass in dump_path, stop using gArgs (Carl Dong)bd4407817eDumpMempool: Use std::chrono instead of weird int64_t arthmetics (Carl Dong)c84390b741test/mempool_persist: Test manual savemempool when -persistmempool=0 (Carl Dong) Pull request description: This is part of the `libbitcoinkernel` project: #24303, https://github.com/bitcoin/bitcoin/projects/18 ----- This PR moves `{Dump,Load}Mempool` into its own `kernel/mempool_persist` module and introduces `ArgsManager` `node::` helpers in `node/mempool_persist_args`to remove the scattered calls to `GetBoolArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)`. More context can be gleaned from the commit messages. ----- One thing I was reflecting on as I wrote this was that in the long run, I think we should probably invert the validation <-> mempool relationship. Instead of mempool not depending on validation, it might make more sense to have validation not depend on mempool. Not super urgent since `libbitcoinkernel` will include both validation and mempool, but perhaps something for the future. ACKs for top commit: glozow: re ACKcb3e9a1e3fvia `git range-diff 7ae032e...cb3e9a1` MarcoFalke: ACKcb3e9a1e3f🔒 ryanofsky: Code review ACKcb3e9a1e3fTree-SHA512: 979d7237c3abb5a1dd9b5ad3dbf3b954f906a6d8320ed7b923557f41a4472deccae3e8a6bca0018c8e7a3c4a93afecc502acd1e26756f2054f157f1c0edd939d
This commit is contained in:
@@ -141,6 +141,16 @@ class MempoolPersistTest(BitcoinTestFramework):
|
||||
self.nodes[2].syncwithvalidationinterfacequeue() # Flush mempool to wallet
|
||||
assert_equal(node2_balance, wallet_watch.getbalance())
|
||||
|
||||
mempooldat0 = os.path.join(self.nodes[0].datadir, self.chain, 'mempool.dat')
|
||||
mempooldat1 = os.path.join(self.nodes[1].datadir, self.chain, 'mempool.dat')
|
||||
|
||||
self.log.debug("Force -persistmempool=0 node1 to savemempool to disk via RPC")
|
||||
assert not os.path.exists(mempooldat1)
|
||||
result1 = self.nodes[1].savemempool()
|
||||
assert os.path.isfile(mempooldat1)
|
||||
assert_equal(result1['filename'], mempooldat1)
|
||||
os.remove(mempooldat1)
|
||||
|
||||
self.log.debug("Stop-start node0 with -persistmempool=0. Verify that it doesn't load its mempool.dat file.")
|
||||
self.stop_nodes()
|
||||
self.start_node(0, extra_args=["-persistmempool=0"])
|
||||
@@ -153,8 +163,6 @@ class MempoolPersistTest(BitcoinTestFramework):
|
||||
assert self.nodes[0].getmempoolinfo()["loaded"]
|
||||
assert_equal(len(self.nodes[0].getrawmempool()), 7)
|
||||
|
||||
mempooldat0 = os.path.join(self.nodes[0].datadir, self.chain, 'mempool.dat')
|
||||
mempooldat1 = os.path.join(self.nodes[1].datadir, self.chain, 'mempool.dat')
|
||||
self.log.debug("Remove the mempool.dat file. Verify that savemempool to disk via RPC re-creates it")
|
||||
os.remove(mempooldat0)
|
||||
result0 = self.nodes[0].savemempool()
|
||||
|
||||
Reference in New Issue
Block a user