aboutsummaryrefslogtreecommitdiff
path: root/src/node/mempool_persist_args.cpp
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-07-12 15:54:11 -0400
committerCarl Dong <contact@carldong.me>2022-07-15 11:30:50 -0400
commit413f4bb52b72e082ad8716664ede48352b8e7e5a (patch)
tree0693604f576339340584525094aebfc7efbb41b2 /src/node/mempool_persist_args.cpp
parentbd4407817e523e3c5b347bc6be25ed007cb27034 (diff)
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/node/mempool_persist_args.cpp')
-rw-r--r--src/node/mempool_persist_args.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/node/mempool_persist_args.cpp b/src/node/mempool_persist_args.cpp
new file mode 100644
index 0000000000..4e775869c6
--- /dev/null
+++ b/src/node/mempool_persist_args.cpp
@@ -0,0 +1,23 @@
+// Copyright (c) 2022 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include <node/mempool_persist_args.h>
+
+#include <fs.h>
+#include <util/system.h>
+#include <validation.h>
+
+namespace node {
+
+bool ShouldPersistMempool(const ArgsManager& argsman)
+{
+ return argsman.GetBoolArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL);
+}
+
+fs::path MempoolPath(const ArgsManager& argsman)
+{
+ return argsman.GetDataDirNet() / "mempool.dat";
+}
+
+} // namespace node