From 27ce808fb546eba0204cdcb2d87b62efdf583c62 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 21 Apr 2015 10:14:06 +0200 Subject: [PATCH] tests: Error when setgenerate is used on regtest Ever since #5957 there has been the problem that older RPC test cases (as can be found plenty in open pulls) use setgenerate() on regtest, assuming a different interpretation of the arguments. Directly generating a number of blocks has been split off into a new method `generate` - however using `setgenerate` with the previous arguments will result in spawning an unreasonable number of threads, and well, simply not work as expected without clear indication of the error. Add an error to point the user at the right method. --- src/rpcmining.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 851d113f3..aba250ba4 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -196,6 +196,8 @@ Value setgenerate(const Array& params, bool fHelp) if (pwalletMain == NULL) throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (disabled)"); + if (Params().MineBlocksOnDemand()) + throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Use the generate method instead of setgenerate on this network"); bool fGenerate = true; if (params.size() > 0)