aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorJorge Timón <jtimon@jtimon.cc>2018-01-12 21:38:48 +0100
committerJorge Timón <jtimon@jtimon.cc>2018-03-29 06:24:30 +0200
commitcb1e319fe9e198c9c5cf5236fe9af5a3d748b9e8 (patch)
tree8838739229d115b134824dcb04c2494ac87b8379 /src/rpc
parent624bee96597c1d59018e58131b8285c0b332700d (diff)
Bugfix: RPC: savemempool: Don't save until LoadMempool() is finished
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/blockchain.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index e15dad2f0b..31cbec4c86 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1607,13 +1607,17 @@ UniValue savemempool(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 0) {
throw std::runtime_error(
"savemempool\n"
- "\nDumps the mempool to disk.\n"
+ "\nDumps the mempool to disk. It will fail until the previous dump is fully loaded.\n"
"\nExamples:\n"
+ HelpExampleCli("savemempool", "")
+ HelpExampleRpc("savemempool", "")
);
}
+ if (!g_is_mempool_loaded) {
+ throw JSONRPCError(RPC_MISC_ERROR, "The mempool was not loaded yet");
+ }
+
if (!DumpMempool()) {
throw JSONRPCError(RPC_MISC_ERROR, "Unable to dump mempool to disk");
}