aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-11-21 14:07:55 +1000
committerGavin Andresen <gavinandresen@gmail.com>2013-11-22 09:51:13 +1000
commitc8b74258bad399d39262ed11b892a729196cb297 (patch)
treeb91c7296f6d8ecde1c0297d57a68ecc8dc257ce2 /src/init.cpp
parent34f5b0ab93e4f92e92531afa090caba06a031c68 (diff)
setgenerate creates multiple blocks in -regtest mode
I'm writing some wallet regression tests using -regtest mode, and need to generate an initial multi-hundred-block chain. Repeatedly calling setgenerate to generate one block is slow and doesn't work properly, because block creation happens asynchronously. This adds two features to setgenerate in -regtest mode: 1) Instead of being interpreted as number of threads to start, the third argument is the number of blocks to generate. 2) setgenerate will not return until the block creation threads have created the requested number of blocks.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index b2e7ddf335..16eccc6de0 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -112,7 +112,7 @@ void Shutdown()
ShutdownRPCMining();
if (pwalletMain)
bitdb.Flush(false);
- GenerateBitcoins(false, NULL);
+ GenerateBitcoins(false, NULL, 0);
StopNode();
{
LOCK(cs_main);
@@ -1050,7 +1050,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
// Generate coins in the background
if (pwalletMain)
- GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain);
+ GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", -1));
// ********************************************************* Step 12: finished