mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Add MiningRequiresPeers chain parameter
This commit is contained in:
@@ -512,7 +512,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
||||
unsigned int nExtraNonce = 0;
|
||||
|
||||
try { while (true) {
|
||||
if (Params().NetworkID() != CChainParams::REGTEST) {
|
||||
if (Params().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())
|
||||
@@ -620,7 +620,8 @@ void static BitcoinMiner(CWallet *pwallet)
|
||||
|
||||
// Check for stop or if block needs to be rebuilt
|
||||
boost::this_thread::interruption_point();
|
||||
if (vNodes.empty() && Params().NetworkID() != CChainParams::REGTEST)
|
||||
// Regtest mode doesn't require peers
|
||||
if (vNodes.empty() && Params().MiningRequiresPeers())
|
||||
break;
|
||||
if (nBlockNonce >= 0xffff0000)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user