Browse Source
Merge pull request #6123
bba7c24
Avoid crash on start in TestBlockValidity with gen=1. (Gregory Maxwell)
pull/145/head
Wladimir J. van der Laan
9 years ago
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
1 changed files with
14 additions and
1 deletions
-
src/miner.cpp
|
|
@ -453,8 +453,16 @@ void static BitcoinMiner(CWallet *pwallet) |
|
|
|
if (chainparams.MiningRequiresPeers()) { |
|
|
|
// Busy-wait for the network to come online so we don't waste time mining
|
|
|
|
// on an obsolete chain. In regtest mode we expect to fly solo.
|
|
|
|
while (vNodes.empty()) |
|
|
|
do { |
|
|
|
bool fvNodesEmpty; |
|
|
|
{ |
|
|
|
LOCK(cs_vNodes); |
|
|
|
fvNodesEmpty = vNodes.empty(); |
|
|
|
} |
|
|
|
if (!fvNodesEmpty && !IsInitialBlockDownload()) |
|
|
|
break; |
|
|
|
MilliSleep(1000); |
|
|
|
} while (true); |
|
|
|
} |
|
|
|
|
|
|
|
//
|
|
|
@ -533,6 +541,11 @@ void static BitcoinMiner(CWallet *pwallet) |
|
|
|
LogPrintf("BitcoinMiner terminated\n"); |
|
|
|
throw; |
|
|
|
} |
|
|
|
catch (const std::runtime_error &e) |
|
|
|
{ |
|
|
|
LogPrintf("BitcoinMiner runtime error: %s\n", e.what()); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads) |
|
|
|