From dd774a337ea53da7f120e861f1c96be7eed56d5d Mon Sep 17 00:00:00 2001 From: pooler Date: Fri, 28 Mar 2014 11:13:10 +0100 Subject: [PATCH] Only increment extranonce2 when needed --- cpu-miner.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu-miner.c b/cpu-miner.c index 95f9f26..a5685a6 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -664,7 +664,7 @@ static void *miner_thread(void *userdata) { struct thr_info *mythr = userdata; int thr_id = mythr->id; - struct work work; + struct work work = {{0}}; uint32_t max_nonce; uint32_t end_nonce = 0xffffffffU / opt_n_threads * (thr_id + 1) - 0x20; unsigned char *scratchbuf = NULL; @@ -703,7 +703,7 @@ static void *miner_thread(void *userdata) while (time(NULL) >= g_work_time + 120) sleep(1); pthread_mutex_lock(&g_work_lock); - if (work.data[19] >= end_nonce) + if (work.data[19] >= end_nonce && !memcmp(work.data, g_work.data, 76)) stratum_gen_work(&stratum, &g_work); } else { /* obtain new work from internal workio thread */