Bugfix: RPC: savemempool: Don't save until LoadMempool() is finished

This commit is contained in:
Jorge Timón
2018-01-12 21:38:48 +01:00
parent 624bee9659
commit cb1e319fe9
4 changed files with 9 additions and 4 deletions

View File

@@ -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");
}