diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-03-30 00:25:43 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-03-30 00:26:23 +0200 |
commit | 3b62a913865777426c11992bae622fb48aa72a40 (patch) | |
tree | 4f84108616f18b0cae9fc0aeba570ef238ddc05f /src/rpc | |
parent | de6bdfd78f22a8f4f51a519fe0e72dd16920156d (diff) | |
parent | cb1e319fe9e198c9c5cf5236fe9af5a3d748b9e8 (diff) |
Merge #12172: Bugfix: RPC: savemempool: Don't save until LoadMempool() is finished
cb1e319 Bugfix: RPC: savemempool: Don't save until LoadMempool() is finished (Jorge Timón)
Pull request description:
Fixes https://github.com/bitcoin/bitcoin/issues/12142
The tests are a little bit slow, mempool_persist.py goes from about 20 s to about 120 s in my hardware.
Perhaps there's a better way to test this.
Tree-SHA512: 9e6c24b32a9cf3774e8f0bd81c035b0deb53fba5ac3eb2532d85900579d21cef8a1135b75a4fa0a9d883e3822eb35e7d4b47a0838abf99789039205041962629
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/blockchain.cpp | 6 |
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"); } |