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/rpc/mempool.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/rpc/mempool.cpp')
-rw-r--r-- | src/rpc/mempool.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp index 84d43e7818..bab358d50a 100644 --- a/src/rpc/mempool.cpp +++ b/src/rpc/mempool.cpp @@ -8,6 +8,7 @@ #include <chainparams.h> #include <core_io.h> #include <fs.h> +#include <node/mempool_persist_args.h> #include <policy/rbf.h> #include <policy/settings.h> #include <primitives/transaction.h> @@ -19,6 +20,8 @@ #include <util/moneystr.h> using node::DEFAULT_MAX_RAW_TX_FEE_RATE; +using node::MempoolPath; +using node::ShouldPersistMempool; using node::NodeContext; static RPCHelpMan sendrawtransaction() @@ -721,12 +724,14 @@ static RPCHelpMan savemempool() throw JSONRPCError(RPC_MISC_ERROR, "The mempool was not loaded yet"); } - if (!DumpMempool(mempool)) { + const fs::path& dump_path = MempoolPath(args); + + if (!DumpMempool(mempool, dump_path)) { throw JSONRPCError(RPC_MISC_ERROR, "Unable to dump mempool to disk"); } UniValue ret(UniValue::VOBJ); - ret.pushKV("filename", fs::path((args.GetDataDirNet() / "mempool.dat")).u8string()); + ret.pushKV("filename", dump_path.u8string()); return ret; }, |