diff options
author | Carl Dong <contact@carldong.me> | 2022-07-12 15:54:11 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2022-07-15 11:30:50 -0400 |
commit | 413f4bb52b72e082ad8716664ede48352b8e7e5a (patch) | |
tree | 0693604f576339340584525094aebfc7efbb41b2 /src/init.cpp | |
parent | bd4407817e523e3c5b347bc6be25ed007cb27034 (diff) | |
download | bitcoin-413f4bb52b72e082ad8716664ede48352b8e7e5a.tar.xz |
DumpMempool: Pass in dump_path, stop using gArgs
Also introduce node::{ShouldPersistMempool,MempoolPath} helper functions
in node/mempool_persist_args.{h,cpp} which are used by non-kernel
DumpMempool callers to determine whether or not to automatically dump
the mempool and where to dump it to.
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp index eff37e1a83..fc068cf25e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -41,6 +41,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> @@ -111,6 +112,8 @@ using node::CleanupBlockRevFiles; 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; @@ -246,8 +249,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->IsLoaded() && ShouldPersistMempool(*node.args)) { + DumpMempool(*node.mempool, MempoolPath(*node.args)); } // Drop transactions we were still watching, and record fee estimations. |