mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-21 22:15:59 +02:00
Add filename to savemempool RPC result
This commit is contained in:
parent
7efc628539
commit
871e64d22f
@ -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;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user