Browse Source

enhance vanilla second nonce check

2upstream
Tanguy Pruvot 8 years ago
parent
commit
096f136c36
  1. 5
      Algo256/decred.cu
  2. 12
      Algo256/vanilla.cu

5
Algo256/decred.cu

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

12
Algo256/vanilla.cu

@ -381,14 +381,20 @@ extern "C" int scanhash_vanilla(int thr_id, struct work* work, uint32_t max_nonc
rc = 1; rc = 1;
work_set_target_ratio(work, vhashcpu); work_set_target_ratio(work, vhashcpu);
*hashes_done = pdata[19] - first_nonce + throughput; *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 NBN > 1
if (h_resNonce[thr_id][1] != UINT32_MAX) { if (h_resNonce[thr_id][1] != UINT32_MAX) {
pdata[21] = h_resNonce[thr_id][1]; work->nonces[1] = h_resNonce[thr_id][1];
applog(LOG_BLUE, "1:%x 2:%x", h_resNonce[thr_id][0], 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; rc = 2;
} }
#endif #endif
pdata[19] = work->nonces[0];
return rc; return rc;
} }
else { else {

Loading…
Cancel
Save