Skip to content

Commit 871e64d

Browse files
committed
Add filename to savemempool RPC result
1 parent 7efc628 commit 871e64d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/rpc/blockchain.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,7 +2202,11 @@ static RPCHelpMan savemempool()
22022202
return RPCHelpMan{"savemempool",
22032203
"\nDumps the mempool to disk. It will fail until the previous dump is fully loaded.\n",
22042204
{},
2205-
RPCResult{RPCResult::Type::NONE, "", ""},
2205+
RPCResult{
2206+
RPCResult::Type::OBJ, "", "",
2207+
{
2208+
{RPCResult::Type::STR, "filename", "the directory and file where the mempool was saved"},
2209+
}},
22062210
RPCExamples{
22072211
HelpExampleCli("savemempool", "")
22082212
+ HelpExampleRpc("savemempool", "")
@@ -2211,6 +2215,8 @@ static RPCHelpMan savemempool()
22112215
{
22122216
const CTxMemPool& mempool = EnsureAnyMemPool(request.context);
22132217

2218+
const NodeContext& node = EnsureAnyNodeContext(request.context);
2219+
22142220
if (!mempool.IsLoaded()) {
22152221
throw JSONRPCError(RPC_MISC_ERROR, "The mempool was not loaded yet");
22162222
}
@@ -2219,7 +2225,10 @@ static RPCHelpMan savemempool()
22192225
throw JSONRPCError(RPC_MISC_ERROR, "Unable to dump mempool to disk");
22202226
}
22212227

2222-
return NullUniValue;
2228+
UniValue ret(UniValue::VOBJ);
2229+
ret.pushKV("filename", fs::path((node.args->GetDataDirNet() / "mempool.dat")).u8string());
2230+
2231+
return ret;
22232232
},
22242233
};
22252234
}

0 commit comments

Comments
 (0)