aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorLawrence Nahum <lawrence@greenaddress.it>2017-08-21 13:23:18 +0200
committerLawrence Nahum <lawrence@greenaddress.it>2017-09-06 09:44:36 +0200
commit1aa97ee088ea03dd208be054c5ad9198c1f13329 (patch)
tree6b01b565a368f2100f2446c9a605a1d7e63b6b9f /src/rpc
parent467cbbcbfc8876ae0955aaf82f2af83c352ad27f (diff)
downloadbitcoin-1aa97ee088ea03dd208be054c5ad9198c1f13329.tar.xz
Add savemempool RPC
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/blockchain.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index ef61e5a55d..0acaf8aedb 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"} },