What changed, and why it matters
This patch changes how XMRig resets its internal counter (nonce) when switching between the user's mining job and the built-in donation mining job. Previously, the nonce was reset during these switches, which could cause duplicate work and stale shares. The fix avoids resetting the nonce when switching to or from donation rounds, likely improving mining efficiency and reducing rejected shares. There is no direct evidence this is a security vulnerability.
Treat as a routine bug fix. No immediate security action required. If issue #3669 is available, review it to confirm whether it describes any security-relevant impact such as share duplication attacks or pool-side issues.
Security signals we found
No direct security signals in diff
Change relates to mining correctness/efficiency, not access control or memory safety
Issue reference (#3669) suggests bug fix for stale/duplicate shares, not a security flaw
Evidence from the diff
In src/core/Miner.cpp, setJob() now tracks whether the new job has the same index (user=0, donate=1) as the current job. The RandomX dataset initialization path previously forced a nonce reset whenever the dataset wasn’t ready. The patch adds a condition so the reset only happens if the job index hasn’t changed, preventing nonce resets during user/donation round transitions. This is described as a possible fix for issue #3669, which likely involved stale shares or duplicate nonces during donation rounds.
Changed components
src/core/Miner.cppRandomX nonce reset logicDonation round job switchingInspect captured patch +3 / −1
### src/core/Miner.cpp
@@ -574,6 +574,7 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
mutex.lock();
const uint8_t index = donate ? 1 : 0;
+ const bool same_job_index = d_ptr->job.index() == index;
d_ptr->reset = !(d_ptr->job.index() == 1 && index == 0 && d_ptr->userJobId == job.id());
@@ -593,7 +594,8 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
const bool ready = d_ptr->initRX();
// Always reset nonce on RandomX dataset change
- if (!ready) {
+ // Except for switching to/from donation
+ if (!ready && same_job_index) {
d_ptr->reset = true;
}
# elseWhy this scored 22/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.