diff options
author | lsilva01 <lsilva01@protonmail.com> | 2021-10-30 15:18:05 -0300 |
---|---|---|
committer | lsilva01 <lsilva01@protonmail.com> | 2021-11-09 12:47:32 -0300 |
commit | 871e64d22f6db8f2e1b312227354aa172a0347c6 (patch) | |
tree | 15f0ab49e0c84200bbb0cadf9eedfb648647efce | |
parent | 7efc628539573af4b4a76d93b853cc46e9e52eae (diff) | |
download | bitcoin-871e64d22f6db8f2e1b312227354aa172a0347c6.tar.xz |
Add filename to savemempool RPC result
-rw-r--r-- | src/rpc/blockchain.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index aa7a55e7a9..55048f6811 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -2202,7 +2202,11 @@ static RPCHelpMan savemempool() return RPCHelpMan{"savemempool", "\nDumps the mempool to disk. It will fail until the previous dump is fully loaded.\n", {}, - RPCResult{RPCResult::Type::NONE, "", ""}, + RPCResult{ + RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::STR, "filename", "the directory and file where the mempool was saved"}, + }}, RPCExamples{ HelpExampleCli("savemempool", "") + HelpExampleRpc("savemempool", "") @@ -2211,6 +2215,8 @@ static RPCHelpMan savemempool() { const CTxMemPool& mempool = EnsureAnyMemPool(request.context); + const NodeContext& node = EnsureAnyNodeContext(request.context); + if (!mempool.IsLoaded()) { throw JSONRPCError(RPC_MISC_ERROR, "The mempool was not loaded yet"); } @@ -2219,7 +2225,10 @@ static RPCHelpMan savemempool() throw JSONRPCError(RPC_MISC_ERROR, "Unable to dump mempool to disk"); } - return NullUniValue; + UniValue ret(UniValue::VOBJ); + ret.pushKV("filename", fs::path((node.args->GetDataDirNet() / "mempool.dat")).u8string()); + + return ret; }, }; } |