mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01: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:
13
src/init.cpp
13
src/init.cpp
@@ -10,6 +10,7 @@
|
||||
#include <init.h>
|
||||
|
||||
#include <kernel/checks.h>
|
||||
#include <kernel/mempool_persist.h>
|
||||
|
||||
#include <addrman.h>
|
||||
#include <banman.h>
|
||||
@@ -41,6 +42,7 @@
|
||||
#include <node/chainstate.h>
|
||||
#include <node/context.h>
|
||||
#include <node/interface_ui.h>
|
||||
#include <node/mempool_persist_args.h>
|
||||
#include <node/miner.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <policy/fees.h>
|
||||
@@ -102,14 +104,19 @@
|
||||
#include <zmq/zmqrpc.h>
|
||||
#endif
|
||||
|
||||
using kernel::DumpMempool;
|
||||
|
||||
using node::CacheSizes;
|
||||
using node::CalculateCacheSizes;
|
||||
using node::ChainstateLoadVerifyError;
|
||||
using node::ChainstateLoadingError;
|
||||
using node::CleanupBlockRevFiles;
|
||||
using node::DEFAULT_PERSIST_MEMPOOL;
|
||||
using node::DEFAULT_PRINTPRIORITY;
|
||||
using node::DEFAULT_STOPAFTERBLOCKIMPORT;
|
||||
using node::LoadChainstate;
|
||||
using node::MempoolPath;
|
||||
using node::ShouldPersistMempool;
|
||||
using node::NodeContext;
|
||||
using node::ThreadImport;
|
||||
using node::VerifyLoadedChainstate;
|
||||
@@ -245,8 +252,8 @@ void Shutdown(NodeContext& node)
|
||||
node.addrman.reset();
|
||||
node.netgroupman.reset();
|
||||
|
||||
if (node.mempool && node.mempool->IsLoaded() && node.args->GetBoolArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
|
||||
DumpMempool(*node.mempool);
|
||||
if (node.mempool && node.mempool->GetLoadTried() && ShouldPersistMempool(*node.args)) {
|
||||
DumpMempool(*node.mempool, MempoolPath(*node.args));
|
||||
}
|
||||
|
||||
// Drop transactions we were still watching, and record fee estimations.
|
||||
@@ -1669,7 +1676,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
}
|
||||
|
||||
chainman.m_load_block = std::thread(&util::TraceThread, "loadblk", [=, &chainman, &args] {
|
||||
ThreadImport(chainman, vImportFiles, args);
|
||||
ThreadImport(chainman, vImportFiles, args, ShouldPersistMempool(args) ? MempoolPath(args) : fs::path{});
|
||||
});
|
||||
|
||||
// Wait for genesis block to be processed
|
||||
|
||||
Reference in New Issue
Block a user