aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r--src/rpc/blockchain.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index dadd82e03f..55048f6811 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -516,7 +516,7 @@ static void entryToJSON(const CTxMemPool& pool, UniValue& info, const CTxMemPool
std::set<std::string> setDepends;
for (const CTxIn& txin : tx.vin)
{
- if (pool.exists(txin.prevout.hash))
+ if (pool.exists(GenTxid::Txid(txin.prevout.hash)))
setDepends.insert(txin.prevout.hash.ToString());
}
@@ -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;
},
};
}