From cac833e5c210d7bfe4aefa1be432bfdb31c0c399 Mon Sep 17 00:00:00 2001 From: Jan Berdajs Date: Wed, 28 May 2014 00:37:53 +0200 Subject: [PATCH] fix bug which can occur when switching from a very low diff algo (darkcoin) to a high diff algo (scrypt), which caused invalid nonces --- sgminer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sgminer.c b/sgminer.c index 67e3b2b5..4d77251a 100644 --- a/sgminer.c +++ b/sgminer.c @@ -6124,8 +6124,13 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work) struct thr_info *thr = mining_thr[i]; thr->cgpu->algorithm = work->pool->algorithm; thr->cgpu->drv->thread_prepare(thr); + + // Necessary because algorithms can have dramatically different diffs + thr->cgpu->drv->working_diff = 1; } rd_unlock(&mining_thr_lock); + // Reset stats (e.g. for working_diff to be set properly in hash_sole_work) + zero_stats(); // Apply other pool-specific settings // TODO: when config parser is improved, add else statements and set // to default intensity