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 };