enhance vanilla second nonce check

This commit is contained in:
Tanguy Pruvot 2016-02-19 11:29:33 +01:00
parent 4944e1a098
commit 096f136c36
2 changed files with 12 additions and 5 deletions

View File

@ -391,7 +391,7 @@ extern "C" int scanhash_decred(int thr_id, struct work* work, uint32_t max_nonce
rc = 1;
work_set_target_ratio(work, vhashcpu);
*hashes_done = (*pnonce) - first_nonce + throughput;
work->nonces[0] = *pnonce = swab32(foundNonce);
work->nonces[0] = swab32(foundNonce);
#if NBN > 1
if (extra_results[0] != UINT32_MAX) {
be32enc(&endiandata[DCR_NONCE_OFT32], extra_results[0]);
@ -400,13 +400,14 @@ extern "C" int scanhash_decred(int thr_id, struct work* work, uint32_t max_nonce
work->nonces[1] = swab32(extra_results[0]);
if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio) {
work_set_target_ratio(work, vhashcpu);
xchg(work->nonces[1], *pnonce);
xchg(work->nonces[1], work->nonces[0]);
}
rc = 2;
}
extra_results[0] = UINT32_MAX;
}
#endif
*pnonce = work->nonces[0];
return rc;
}
else if (opt_debug) {

View File

@ -381,14 +381,20 @@ extern "C" int scanhash_vanilla(int thr_id, struct work* work, uint32_t max_nonc
rc = 1;
work_set_target_ratio(work, vhashcpu);
*hashes_done = pdata[19] - first_nonce + throughput;
pdata[19] = h_resNonce[thr_id][0];
work->nonces[0] = h_resNonce[thr_id][0];
#if NBN > 1
if (h_resNonce[thr_id][1] != UINT32_MAX) {
pdata[21] = h_resNonce[thr_id][1];
applog(LOG_BLUE, "1:%x 2:%x", h_resNonce[thr_id][0], h_resNonce[thr_id][1]);
work->nonces[1] = h_resNonce[thr_id][1];
be32enc(&endiandata[19], work->nonces[1]);
vanillahash(vhashcpu, endiandata, blakerounds);
if (bn_hash_target_ratio(vhashcpu, ptarget) > work->shareratio) {
work_set_target_ratio(work, vhashcpu);
xchg(work->nonces[1], work->nonces[0]);
}
rc = 2;
}
#endif
pdata[19] = work->nonces[0];
return rc;
}
else {