Skip to content
Snippets Groups Projects
Unverified Commit a8e83eec authored by fireice-uk's avatar fireice-uk Committed by GitHub
Browse files

Merge pull request #996 from psychocrypt/fix-cpuNonce2

avoid nonce overlapping
parents f737d248 e191229a
No related branches found
No related tags found
No related merge requests found
...@@ -448,12 +448,13 @@ void minethd::work_main() ...@@ -448,12 +448,13 @@ void minethd::work_main()
globalStates::inst().calc_start_nonce(result.iNonce, oWork.bNiceHash, nonce_chunk); globalStates::inst().calc_start_nonce(result.iNonce, oWork.bNiceHash, nonce_chunk);
} }
*piNonce = ++result.iNonce; *piNonce = result.iNonce;
hash_fun(oWork.bWorkBlob, oWork.iWorkSize, result.bResult, ctx); hash_fun(oWork.bWorkBlob, oWork.iWorkSize, result.bResult, ctx);
if (*piHashVal < oWork.iTarget) if (*piHashVal < oWork.iTarget)
executor::inst()->push_event(ex_event(result, oWork.iPoolId)); executor::inst()->push_event(ex_event(result, oWork.iPoolId));
result.iNonce++;
std::this_thread::yield(); std::this_thread::yield();
} }
...@@ -637,7 +638,7 @@ void minethd::multiway_work_main(cn_hash_fun_multi hash_fun_multi) ...@@ -637,7 +638,7 @@ void minethd::multiway_work_main(cn_hash_fun_multi hash_fun_multi)
} }
for (size_t i = 0; i < N; i++) for (size_t i = 0; i < N; i++)
*piNonce[i] = ++iNonce; *piNonce[i] = iNonce++;
hash_fun_multi(bWorkBlob, oWork.iWorkSize, bHashOut, ctx); hash_fun_multi(bWorkBlob, oWork.iWorkSize, bHashOut, ctx);
...@@ -645,7 +646,7 @@ void minethd::multiway_work_main(cn_hash_fun_multi hash_fun_multi) ...@@ -645,7 +646,7 @@ void minethd::multiway_work_main(cn_hash_fun_multi hash_fun_multi)
{ {
if (*piHashVal[i] < oWork.iTarget) if (*piHashVal[i] < oWork.iTarget)
{ {
executor::inst()->push_event(ex_event(job_result(oWork.sJobID, iNonce - N + 1 + i, bHashOut + 32 * i, iThreadNo), oWork.iPoolId)); executor::inst()->push_event(ex_event(job_result(oWork.sJobID, iNonce - N + i, bHashOut + 32 * i, iThreadNo), oWork.iPoolId));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment