|
|
|
@ -1289,15 +1289,18 @@ static bool workio_get_work(struct workio_cmd *wc)
@@ -1289,15 +1289,18 @@ static bool workio_get_work(struct workio_cmd *wc)
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool stale_work(struct work *work) |
|
|
|
|
static bool stale_work(struct work *work, bool rolling) |
|
|
|
|
{ |
|
|
|
|
struct timeval now; |
|
|
|
|
bool ret = false; |
|
|
|
|
char *hexstr; |
|
|
|
|
|
|
|
|
|
gettimeofday(&now, NULL); |
|
|
|
|
if ((now.tv_sec - work->tv_staged.tv_sec) > opt_scantime) |
|
|
|
|
return true; |
|
|
|
|
if (!rolling) { |
|
|
|
|
struct timeval now; |
|
|
|
|
|
|
|
|
|
gettimeofday(&now, NULL); |
|
|
|
|
if ((now.tv_sec - work->tv_staged.tv_sec) > opt_scantime) |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Only use the primary pool for determination as the work may
|
|
|
|
|
* interleave at times of new blocks */ |
|
|
|
@ -1326,7 +1329,7 @@ static void *submit_work_thread(void *userdata)
@@ -1326,7 +1329,7 @@ static void *submit_work_thread(void *userdata)
|
|
|
|
|
|
|
|
|
|
pthread_detach(pthread_self()); |
|
|
|
|
|
|
|
|
|
if (stale_work(work)) { |
|
|
|
|
if (stale_work(work, false)) { |
|
|
|
|
applog(LOG_WARNING, "Stale share detected, discarding"); |
|
|
|
|
total_stale++; |
|
|
|
|
pool->stale_shares++; |
|
|
|
@ -1335,7 +1338,7 @@ static void *submit_work_thread(void *userdata)
@@ -1335,7 +1338,7 @@ static void *submit_work_thread(void *userdata)
|
|
|
|
|
|
|
|
|
|
/* submit solution to bitcoin via JSON-RPC */ |
|
|
|
|
while (!submit_upstream_work(work)) { |
|
|
|
|
if (stale_work(work)) { |
|
|
|
|
if (stale_work(work, false)) { |
|
|
|
|
applog(LOG_WARNING, "Stale share detected, discarding"); |
|
|
|
|
total_stale++; |
|
|
|
|
pool->stale_shares++; |
|
|
|
@ -2412,7 +2415,7 @@ static void flush_requests(void)
@@ -2412,7 +2415,7 @@ static void flush_requests(void)
|
|
|
|
|
|
|
|
|
|
static inline bool can_roll(struct work *work) |
|
|
|
|
{ |
|
|
|
|
return (work->pool && !stale_work(work) && work->pool->has_rolltime && |
|
|
|
|
return (work->pool && !stale_work(work, true) && work->pool->has_rolltime && |
|
|
|
|
work->rolls < 11 && !work->clone); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2520,7 +2523,7 @@ retry:
@@ -2520,7 +2523,7 @@ retry:
|
|
|
|
|
goto retry; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (stale_work(work_heap)) { |
|
|
|
|
if (stale_work(work_heap, false)) { |
|
|
|
|
dec_queued(); |
|
|
|
|
discard_work(work_heap); |
|
|
|
|
goto retry; |
|
|
|
@ -2826,7 +2829,7 @@ static void *miner_thread(void *userdata)
@@ -2826,7 +2829,7 @@ static void *miner_thread(void *userdata)
|
|
|
|
|
decay_time(&hash_divfloat , (double)((MAXTHREADS / total_hashes) ? : 1)); |
|
|
|
|
hash_div = hash_divfloat; |
|
|
|
|
needs_work = true; |
|
|
|
|
} else if (work_restart[thr_id].restart || stale_work(work) || |
|
|
|
|
} else if (work_restart[thr_id].restart || stale_work(work, false) || |
|
|
|
|
work->blk.nonce >= MAXTHREADS - hashes_done) |
|
|
|
|
needs_work = true; |
|
|
|
|
} |
|
|
|
@ -3051,7 +3054,7 @@ static void *gpuminer_thread(void *userdata)
@@ -3051,7 +3054,7 @@ static void *gpuminer_thread(void *userdata)
|
|
|
|
|
if (diff.tv_sec > opt_scantime || |
|
|
|
|
work->blk.nonce >= MAXTHREADS - hashes || |
|
|
|
|
work_restart[thr_id].restart || |
|
|
|
|
stale_work(work)) { |
|
|
|
|
stale_work(work, false)) { |
|
|
|
|
/* Ignore any reads since we're getting new work and queue a clean buffer */ |
|
|
|
|
status = clEnqueueWriteBuffer(clState->commandQueue, clState->outputBuffer, CL_FALSE, 0, |
|
|
|
|
BUFFERSIZE, blank_res, 0, NULL, NULL); |
|
|
|
|