Use AtomicTimer for more accurate local solution rate
This commit is contained in:
@@ -528,12 +528,14 @@ void static BitcoinMiner()
|
||||
cancelSolver = true;
|
||||
}
|
||||
);
|
||||
miningTimer.start();
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
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.
|
||||
miningTimer.stop();
|
||||
do {
|
||||
bool fvNodesEmpty;
|
||||
{
|
||||
@@ -544,6 +546,7 @@ void static BitcoinMiner()
|
||||
break;
|
||||
MilliSleep(1000);
|
||||
} while (true);
|
||||
miningTimer.start();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -721,16 +724,19 @@ void static BitcoinMiner()
|
||||
}
|
||||
catch (const boost::thread_interrupted&)
|
||||
{
|
||||
miningTimer.stop();
|
||||
c.disconnect();
|
||||
LogPrintf("ZcashMiner terminated\n");
|
||||
throw;
|
||||
}
|
||||
catch (const std::runtime_error &e)
|
||||
{
|
||||
miningTimer.stop();
|
||||
c.disconnect();
|
||||
LogPrintf("ZcashMiner runtime error: %s\n", e.what());
|
||||
return;
|
||||
}
|
||||
miningTimer.stop();
|
||||
c.disconnect();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user