From cf077902d01b624be51a485bd8475ce01d01938a Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 8 Jun 2015 16:47:23 +0200 Subject: [PATCH] skein: fix sm5 secNonce and disable it on wallets --- skein.cu | 5 +++-- skein2.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/skein.cu b/skein.cu index b8498c6..08ee28c 100644 --- a/skein.cu +++ b/skein.cu @@ -355,6 +355,7 @@ extern "C" int scanhash_skeincoin(int thr_id, uint32_t *pdata, const uint32_t *p const int swap = 1; bool sm5 = (device_sm[device_map[thr_id]] >= 500); + bool checkSecnonce = (have_stratum || have_longpoll) && !sm5; uint32_t throughput = device_intensity(thr_id, __func__, 1U << 20); throughput = min(throughput, (max_nonce - first_nonce)); @@ -416,10 +417,10 @@ extern "C" int scanhash_skeincoin(int thr_id, uint32_t *pdata, const uint32_t *p if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) { int res = 1; uint8_t num = res; - if (!sm5) { + if (checkSecnonce) { secNonce = cuda_check_hash_suppl(thr_id, throughput, pdata[19], d_hash[thr_id], num); } - while (secNonce != 0 && res < 2) /* todo: up to 6 */ + while (checkSecnonce && secNonce != 0 && res < 2) /* todo: up to 6 */ { endiandata[19] = swab32_if(secNonce, swap); skeincoinhash(vhash64, endiandata); diff --git a/skein2.cpp b/skein2.cpp index bdb170e..e9b2d55 100644 --- a/skein2.cpp +++ b/skein2.cpp @@ -101,7 +101,7 @@ int scanhash_skein2(int thr_id, uint32_t *pdata, const uint32_t *ptarget, } } - if ((uint64_t) pdata[19] + throughput > max_nonce) { + if ((uint64_t) throughput + pdata[19] > max_nonce) { *hashes_done = pdata[19] - first_nonce; pdata[19] = max_nonce; break;