Only increment extranonce2 when needed

This commit is contained in:
pooler 2014-03-28 11:13:10 +01:00
parent cdf82b4090
commit dd774a337e

View file

@ -664,7 +664,7 @@ static void *miner_thread(void *userdata)
{ {
struct thr_info *mythr = userdata; struct thr_info *mythr = userdata;
int thr_id = mythr->id; int thr_id = mythr->id;
struct work work; struct work work = {{0}};
uint32_t max_nonce; uint32_t max_nonce;
uint32_t end_nonce = 0xffffffffU / opt_n_threads * (thr_id + 1) - 0x20; uint32_t end_nonce = 0xffffffffU / opt_n_threads * (thr_id + 1) - 0x20;
unsigned char *scratchbuf = NULL; unsigned char *scratchbuf = NULL;
@ -703,7 +703,7 @@ static void *miner_thread(void *userdata)
while (time(NULL) >= g_work_time + 120) while (time(NULL) >= g_work_time + 120)
sleep(1); sleep(1);
pthread_mutex_lock(&g_work_lock); 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); stratum_gen_work(&stratum, &g_work);
} else { } else {
/* obtain new work from internal workio thread */ /* obtain new work from internal workio thread */