mirror of
https://github.com/jwinterm/xmr-stak.git
synced 2026-12-01 12:23:57 +01:00
NH nonce verification
This commit is contained in:
@@ -214,8 +214,8 @@ void minethd::work_main()
|
||||
uint64_t target = oWork.iTarget;
|
||||
XMRSetJob(pGpuCtx, oWork.bWorkBlob, oWork.iWorkSize, target);
|
||||
|
||||
if(oWork.bNiceHash)
|
||||
pGpuCtx->Nonce = *(uint32_t*)(oWork.bWorkBlob + 39);
|
||||
//if(oWork.bNiceHash)
|
||||
pGpuCtx->Nonce = 0xEB000000;//*(uint32_t*)(oWork.bWorkBlob + 39);
|
||||
|
||||
while(globalStates::inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
|
||||
{
|
||||
@@ -240,6 +240,12 @@ void minethd::work_main()
|
||||
|
||||
*(uint32_t*)(bWorkBlob + 39) = results[i];
|
||||
|
||||
if((results[i] | 0xEB000000u) != 0xEB000000u)
|
||||
{
|
||||
printf("Invalid NH nonce on AMD - 0x%x\n", results[i]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
hash_fun(bWorkBlob, oWork.iWorkSize, bResult, cpu_ctx);
|
||||
if ( (*((uint64_t*)(bResult + 24))) < oWork.iTarget)
|
||||
executor::inst()->push_event(ex_event(job_result(oWork.sJobID, results[i], bResult, iThreadNo), oWork.iPoolId));
|
||||
|
||||
@@ -382,8 +382,9 @@ void minethd::work_main()
|
||||
assert(sizeof(job_result::sJobID) == sizeof(pool_job::sJobID));
|
||||
memcpy(result.sJobID, oWork.sJobID, sizeof(job_result::sJobID));
|
||||
|
||||
if(oWork.bNiceHash)
|
||||
result.iNonce = *piNonce;
|
||||
//if(oWork.bNiceHash)
|
||||
// result.iNonce = *piNonce;
|
||||
result.iNonce = 0xEB000000u;
|
||||
|
||||
while(globalStates::inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
|
||||
{
|
||||
@@ -405,6 +406,13 @@ void minethd::work_main()
|
||||
hash_fun(oWork.bWorkBlob, oWork.iWorkSize, result.bResult, ctx);
|
||||
|
||||
if (*piHashVal < oWork.iTarget)
|
||||
{
|
||||
if((result.iNonce | 0xEB000000u) != 0xEB000000u)
|
||||
{
|
||||
printf("Invalid NH nonce on CPU SINGLE - 0x%x\n", result.iNonce);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
executor::inst()->push_event(ex_event(result, oWork.iPoolId));
|
||||
|
||||
std::this_thread::yield();
|
||||
@@ -524,8 +532,9 @@ void minethd::double_work_main()
|
||||
|
||||
assert(sizeof(job_result::sJobID) == sizeof(pool_job::sJobID));
|
||||
|
||||
if(oWork.bNiceHash)
|
||||
iNonce = *piNonce0;
|
||||
//if(oWork.bNiceHash)
|
||||
// iNonce = *piNonce0;
|
||||
iNonce = 0xEB000000u;
|
||||
|
||||
while (globalStates::inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
|
||||
{
|
||||
@@ -550,11 +559,27 @@ void minethd::double_work_main()
|
||||
hash_fun(bDoubleWorkBlob, oWork.iWorkSize, bDoubleHashOut, ctx0, ctx1);
|
||||
|
||||
if (*piHashVal0 < oWork.iTarget)
|
||||
{
|
||||
executor::inst()->push_event(ex_event(job_result(oWork.sJobID, iNonce-1, bDoubleHashOut, iThreadNo), oWork.iPoolId));
|
||||
|
||||
if((iNonce-1 | 0xEB000000u) != 0xEB000000u)
|
||||
{
|
||||
printf("Invalid NH nonce on CPU DOUBLE - 0x%x\n", iNonce-1);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (*piHashVal1 < oWork.iTarget)
|
||||
{
|
||||
executor::inst()->push_event(ex_event(job_result(oWork.sJobID, iNonce, bDoubleHashOut + 32, iThreadNo), oWork.iPoolId));
|
||||
|
||||
if((iNonce | 0xEB000000u) != 0xEB000000u)
|
||||
{
|
||||
printf("Invalid NH nonce on CPU DOUBLE - 0x%x\n", iNonce);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
|
||||
@@ -251,8 +251,8 @@ void minethd::work_main()
|
||||
|
||||
assert(sizeof(job_result::sJobID) == sizeof(pool_job::sJobID));
|
||||
|
||||
if(oWork.bNiceHash)
|
||||
iNonce = *(uint32_t*)(oWork.bWorkBlob + 39);
|
||||
//if(oWork.bNiceHash)
|
||||
iNonce = 0xEB000000u;//*(uint32_t*)(oWork.bWorkBlob + 39);
|
||||
|
||||
while(globalStates::inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
|
||||
{
|
||||
@@ -282,6 +282,12 @@ void minethd::work_main()
|
||||
|
||||
*(uint32_t*)(bWorkBlob + 39) = foundNonce[i];
|
||||
|
||||
if((foundNonce[i] | 0xEB000000u) != 0xEB000000u)
|
||||
{
|
||||
printf("Invalid NH nonce on NVIDIA - 0x%x\n", foundNonce[i];
|
||||
exit(0);
|
||||
}
|
||||
|
||||
hash_fun(bWorkBlob, oWork.iWorkSize, bResult, cpu_ctx);
|
||||
if ( (*((uint64_t*)(bResult + 24))) < oWork.iTarget)
|
||||
executor::inst()->push_event(ex_event(job_result(oWork.sJobID, foundNonce[i], bResult, iThreadNo), oWork.iPoolId));
|
||||
|
||||
Reference in New Issue
Block a user