Browse Source

We should serialise calls to GBT, not just update_base

master
Con Kolivas 9 years ago
parent
commit
96f055486c
  1. 7
      src/stratifier.c

7
src/stratifier.c

@ -921,6 +921,8 @@ static void *do_update(void *arg)
pthread_detach(pthread_self());
rename_proc("updater");
/* Serialise access to getbase to avoid out of order new block notifies */
cksem_wait(&sdata->update_sem);
retry:
buf = send_recv_generator(ckp, "getbase", prio);
if (unlikely(!buf)) {
@ -976,8 +978,6 @@ retry:
json_decref(val);
generate_coinbase(ckp, wb);
/* Serialise access to add_base to avoid out of order new block notifies */
cksem_wait(&sdata->update_sem);
add_base(ckp, wb, &new_block);
/* Reset the update time to avoid stacked low priority notifies. Bring
* forward the next notify in case of a new block. */
@ -985,12 +985,13 @@ retry:
if (new_block)
now_t -= ckp->update_interval / 2;
sdata->update_time = now_t;
cksem_post(&sdata->update_sem);
stratum_broadcast_update(sdata, new_block);
ret = true;
LOGINFO("Broadcast updated stratum base");
out:
cksem_post(&sdata->update_sem);
/* Send a ping to miners if we fail to get a base to keep them
* connected while bitcoind recovers(?) */
if (unlikely(!ret)) {

Loading…
Cancel
Save