Buffer --rand-nonce option without having to continuously execute a function

This commit is contained in:
Fusl 2017-07-25 05:10:26 +02:00
parent 6516517235
commit 2ee4b2c91d

View file

@ -38,6 +38,7 @@ SingleWorker::SingleWorker(Handle *handle)
void SingleWorker::start() void SingleWorker::start()
{ {
bool israndnonce = false;
while (Workers::sequence() > 0) { while (Workers::sequence() > 0) {
if (Workers::isPaused()) { if (Workers::isPaused()) {
do { do {
@ -48,13 +49,14 @@ void SingleWorker::start()
consumeJob(); consumeJob();
} }
israndnonce = m_job.isRandNonce();
while (!Workers::isOutdated(m_sequence)) { while (!Workers::isOutdated(m_sequence)) {
if ((m_count & 0xF) == 0) { if ((m_count & 0xF) == 0) {
storeStats(); storeStats();
} }
m_count++; m_count++;
if (m_job.isRandNonce()) { if (israndnonce) {
*m_job.nonce() = m_result.nonce += rand(); *m_job.nonce() = m_result.nonce += rand();
} else { } else {
*m_job.nonce() = ++m_result.nonce; *m_job.nonce() = ++m_result.nonce;