Skip to content

Commit

Permalink
tests: Error when setgenerate is used on regtest
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
laanwj committed Apr 21, 2015
1 parent b6ea3bc commit 27ce808
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rpcmining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 27ce808

Please sign in to comment.