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