Browse Source

The longpoll blanking of the current_block data may not be happening before the work is converted and appears to be a detected block change.

Blank the current block before submitting the work and stop passing the longpoll bool around.
nfactor-troky
Con Kolivas 14 years ago
parent
commit
ad53696f3f
  1. 13
      main.c

13
main.c

@ -1783,15 +1783,13 @@ static void discard_staged(void)
total_discarded++; total_discarded++;
} }
static void flush_requests(bool longpoll) static void flush_requests(void)
{ {
struct pool *pool = current_pool(); struct pool *pool = current_pool();
int i, stale; int i, stale;
/* We should have one fresh work item staged from the block change. */ /* We should have one fresh work item staged from the block change. */
stale = requests_staged() - 1; stale = requests_staged() - 1;
if (longpoll)
memcpy(current_block, blank, 36);
/* Temporarily increase the staged count so that get_work thinks there /* Temporarily increase the staged count so that get_work thinks there
* is work available instead of making threads reuse existing work */ * is work available instead of making threads reuse existing work */
@ -2366,12 +2364,12 @@ out:
} }
#endif /* HAVE_OPENCL */ #endif /* HAVE_OPENCL */
static void restart_threads(bool longpoll) static void restart_threads(void)
{ {
int i; int i;
/* Discard old queued requests and get new ones */ /* Discard old queued requests and get new ones */
flush_requests(longpoll); flush_requests();
for (i = 0; i < mining_threads; i++) for (i = 0; i < mining_threads; i++)
work_restart[i].restart = 1; work_restart[i].restart = 1;
@ -2463,7 +2461,8 @@ next_path:
!strncmp(longpoll_block, current_block, 36))) { !strncmp(longpoll_block, current_block, 36))) {
new_blocks++; new_blocks++;
applog(LOG_WARNING, "LONGPOLL detected new block on network, waiting on fresh work"); applog(LOG_WARNING, "LONGPOLL detected new block on network, waiting on fresh work");
restart_threads(true); memcpy(current_block, blank, 36);
restart_threads();
} else } else
applog(LOG_WARNING, "LONGPOLL received after new block already detected"); applog(LOG_WARNING, "LONGPOLL received after new block already detected");
@ -2636,7 +2635,7 @@ static void *watchdog_thread(void *userdata)
} }
if (unlikely(work_restart[watchdog_thr_id].restart)) { if (unlikely(work_restart[watchdog_thr_id].restart)) {
restart_threads(false); restart_threads();
work_restart[watchdog_thr_id].restart = 0; work_restart[watchdog_thr_id].restart = 0;
} }

Loading…
Cancel
Save