From c8b74258bad399d39262ed11b892a729196cb297 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 21 Nov 2013 14:07:55 +1000 Subject: 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. --- src/init.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index b2e7ddf33..16eccc6de 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 -- cgit v1.2.3