Merge pull request #1760 from SChernykh/dev
KawPow: fixed rare duplicate share errors
This commit is contained in:
commit
34a5c89ee2
1 changed files with 11 additions and 4 deletions
|
@ -139,11 +139,18 @@ inline bool xmrig::WorkerJob<1>::nextRound(uint32_t rounds, uint32_t roundSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increment higher 32 bits of a 64-bit nonce when lower 32 bits overflow
|
// Increment higher 32 bits of a 64-bit nonce when lower 32 bits overflow
|
||||||
if (!currentJob().isNicehash() && (nonceSize() == sizeof(uint64_t)) && (*n < prev_nonce)) {
|
if (!currentJob().isNicehash() && (nonceSize() == sizeof(uint64_t))) {
|
||||||
++n[1];
|
const bool wrapped = (*n < prev_nonce);
|
||||||
|
const bool wraps_this_round = (static_cast<uint64_t>(*n) + roundSize > (1ULL << 32));
|
||||||
|
|
||||||
Job& job = m_jobs[index()];
|
// Account for the case when starting nonce hasn't wrapped yet, but some nonces in the current round will wrap
|
||||||
memcpy(job.blob(), blob(), job.size());
|
if (wrapped | wraps_this_round) {
|
||||||
|
*n = 0; // Set lower 32 bits to 0 when higher 32 bits change
|
||||||
|
++n[1];
|
||||||
|
|
||||||
|
Job& job = m_jobs[index()];
|
||||||
|
memcpy(job.blob(), blob(), job.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue