diff --git a/cpu-miner.c b/cpu-miner.c index cf6d76c..f744211 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -1024,11 +1024,12 @@ static void *miner_thread(void *userdata) if (work.data[19] >= end_nonce && !memcmp(work.data, g_work.data, 76)) stratum_gen_work(&stratum, &g_work); } else { + int min_scantime = have_longpoll ? LP_SCANTIME : opt_scantime; /* obtain new work from internal workio thread */ pthread_mutex_lock(&g_work_lock); - if (!have_stratum && (!have_longpoll || - time(NULL) >= g_work_time + LP_SCANTIME*3/4 || - work.data[19] >= end_nonce)) { + if (!have_stratum && + (time(NULL) - g_work_time >= min_scantime || + work.data[19] >= end_nonce)) { if (unlikely(!get_work(mythr, &g_work))) { applog(LOG_ERR, "work retrieval failed, exiting " "mining thread %d", mythr->id);