Avoid fetching too much work when LP is off
This commit is contained in:
parent
a9e64f41e7
commit
106d03882e
1 changed files with 4 additions and 3 deletions
|
@ -1024,11 +1024,12 @@ static void *miner_thread(void *userdata)
|
||||||
if (work.data[19] >= end_nonce && !memcmp(work.data, g_work.data, 76))
|
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 {
|
||||||
|
int min_scantime = have_longpoll ? LP_SCANTIME : opt_scantime;
|
||||||
/* obtain new work from internal workio thread */
|
/* obtain new work from internal workio thread */
|
||||||
pthread_mutex_lock(&g_work_lock);
|
pthread_mutex_lock(&g_work_lock);
|
||||||
if (!have_stratum && (!have_longpoll ||
|
if (!have_stratum &&
|
||||||
time(NULL) >= g_work_time + LP_SCANTIME*3/4 ||
|
(time(NULL) - g_work_time >= min_scantime ||
|
||||||
work.data[19] >= end_nonce)) {
|
work.data[19] >= end_nonce)) {
|
||||||
if (unlikely(!get_work(mythr, &g_work))) {
|
if (unlikely(!get_work(mythr, &g_work))) {
|
||||||
applog(LOG_ERR, "work retrieval failed, exiting "
|
applog(LOG_ERR, "work retrieval failed, exiting "
|
||||||
"mining thread %d", mythr->id);
|
"mining thread %d", mythr->id);
|
||||||
|
|
Loading…
Reference in a new issue