aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2020-07-09 17:13:51 +0200
committerJon Atack <jon@atack.com>2020-07-11 07:47:57 +0200
commit92d94ffb8d07cc0d2665c901de5903a3a90d5fd0 (patch)
treec20303a078733b073ce5cf7e1b604d24b326a336
parent8d32d2011d3f4e1d9e587d6f80dfa4a3e9f9393d (diff)
downloadbitcoin-92d94ffb8d07cc0d2665c901de5903a3a90d5fd0.tar.xz
rpc: print useful help and error message for generate
-rw-r--r--src/rpc/mining.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index fee6a893eb..ea961a1514 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -236,6 +236,17 @@ static UniValue generatetodescriptor(const JSONRPCRequest& request)
return generateBlocks(chainman, mempool, coinbase_script, num_blocks, max_tries);
}
+static UniValue generate(const JSONRPCRequest& request)
+{
+ const std::string help_str{"generate ( nblocks maxtries ) has been replaced by the -generate cli option. Refer to -help for more information."};
+
+ if (request.fHelp) {
+ throw std::runtime_error(help_str);
+ } else {
+ throw JSONRPCError(RPC_METHOD_NOT_FOUND, help_str);
+ }
+}
+
static UniValue generatetoaddress(const JSONRPCRequest& request)
{
RPCHelpMan{"generatetoaddress",
@@ -1198,6 +1209,7 @@ static const CRPCCommand commands[] =
{ "util", "estimatesmartfee", &estimatesmartfee, {"conf_target", "estimate_mode"} },
{ "hidden", "estimaterawfee", &estimaterawfee, {"conf_target", "threshold"} },
+ { "hidden", "generate", &generate, {} },
};
// clang-format on