From a273353b322ac0a2abe95a0877c329271d010187 Mon Sep 17 00:00:00 2001 From: Oran Juice Date: Sat, 8 Nov 2014 21:41:43 +0530 Subject: [PATCH] Added stopmining. --- src/rpc/json_rpc_handlers.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/rpc/json_rpc_handlers.h b/src/rpc/json_rpc_handlers.h index a2923638f..e08bd6613 100644 --- a/src/rpc/json_rpc_handlers.h +++ b/src/rpc/json_rpc_handlers.h @@ -300,11 +300,22 @@ namespace RPC return ns_rpc_create_reply(buf, len, req, "{s:s}", "status", CORE_RPC_STATUS_OK); } + int stopmining(char *buf, int len, struct ns_rpc_request *req) + { + CHECK_CORE_BUSY(); + if (!core->get_miner().stop()) + { + return ns_rpc_create_reply(buf, len, req, "{s:s}", "status", "Failed, mining not stopped"); + } + return ns_rpc_create_reply(buf, len, req, "{s:s}", "status", CORE_RPC_STATUS_OK); + } + const char *method_names[] = { "getheight", "getblocks", "gettransactions", "startmining", + "stopmining", NULL }; @@ -313,6 +324,7 @@ namespace RPC getblocks, gettransactions, startmining, + stopmining, NULL };