diff options
| author | Lawrence Nahum <[email protected]> | 2017-08-21 13:23:18 +0200 |
|---|---|---|
| committer | Lawrence Nahum <[email protected]> | 2017-09-06 09:44:36 +0200 |
| commit | 1aa97ee088ea03dd208be054c5ad9198c1f13329 (patch) | |
| tree | 6b01b565a368f2100f2446c9a605a1d7e63b6b9f /src/rpc/blockchain.cpp | |
| parent | Add return value to DumpMempool (diff) | |
| download | discoin-1aa97ee088ea03dd208be054c5ad9198c1f13329.tar.xz discoin-1aa97ee088ea03dd208be054c5ad9198c1f13329.zip | |
Add savemempool RPC
Diffstat (limited to 'src/rpc/blockchain.cpp')
| -rw-r--r-- | src/rpc/blockchain.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index ef61e5a55..0acaf8aed 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1532,6 +1532,25 @@ UniValue getchaintxstats(const JSONRPCRequest& request) return ret; } +UniValue savemempool(const JSONRPCRequest& request) +{ + if (request.fHelp || request.params.size() != 0) { + throw std::runtime_error( + "savemempool\n" + "\nDumps the mempool to disk.\n" + "\nExamples:\n" + + HelpExampleCli("savemempool", "") + + HelpExampleRpc("savemempool", "") + ); + } + + if (!DumpMempool()) { + throw JSONRPCError(RPC_MISC_ERROR, "Unable to dump mempool to disk"); + } + + return NullUniValue; +} + static const CRPCCommand commands[] = { // category name actor (function) argNames // --------------------- ------------------------ ----------------------- ---------- @@ -1552,6 +1571,7 @@ static const CRPCCommand commands[] = { "blockchain", "gettxout", &gettxout, {"txid","n","include_mempool"} }, { "blockchain", "gettxoutsetinfo", &gettxoutsetinfo, {} }, { "blockchain", "pruneblockchain", &pruneblockchain, {"height"} }, + { "blockchain", "savemempool", &savemempool, {} }, { "blockchain", "verifychain", &verifychain, {"checklevel","nblocks"} }, { "blockchain", "preciousblock", &preciousblock, {"blockhash"} }, |