Skip to content

Commit 27ce808

Browse files
committed
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.
1 parent b6ea3bc commit 27ce808

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/rpcmining.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ Value setgenerate(const Array& params, bool fHelp)
196196

197197
if (pwalletMain == NULL)
198198
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (disabled)");
199+
if (Params().MineBlocksOnDemand())
200+
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Use the generate method instead of setgenerate on this network");
199201

200202
bool fGenerate = true;
201203
if (params.size() > 0)

0 commit comments

Comments
 (0)