From a3d7ed2a290863cb01fe4e3e7cdc594c8ada7406 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 30 Jan 2016 11:58:46 +1100 Subject: [PATCH] Reset shares after remote block solves and broadcast remote block solves --- src/stratifier.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index 41535334..3ac420dd 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -2950,22 +2950,22 @@ static void block_solve(ckpool_t *ckp, const char *blockhash) if (!found) { LOGINFO("Failed to find blockhash %s in block_solve, possibly from downstream", blockhash); - return; + } else { + val = found->data; + json_set_string(val, "confirmed", "1"); + json_set_string(val, "createdate", cdfield); + json_set_string(val, "createcode", __func__); + json_get_int(&height, val, "height"); + json_get_double(&diff, val, "diff"); + ckdbq_add(ckp, ID_BLOCK, val); + free(found); + if (ckp->remote) + upstream_block(ckp, height, workername, diff); } - val = found->data; - json_set_string(val, "confirmed", "1"); - json_set_string(val, "createdate", cdfield); - json_set_string(val, "createcode", __func__); - json_get_int(&height, val, "height"); - json_get_double(&diff, val, "diff"); - ckdbq_add(ckp, ID_BLOCK, val); - free(found); - - if (unlikely(!workername)) { - /* This should be impossible! */ - ASPRINTF(&msg, "Block %d solved by %s!", height, ckp->name); - LOGWARNING("Solved and confirmed block %d", height); + if (!workername) { + ASPRINTF(&msg, "Block solved by %s!", ckp->name); + LOGWARNING("Solved and confirmed block!"); } else { json_t *user_val, *worker_val; worker_instance_t *worker; @@ -2993,8 +2993,6 @@ static void block_solve(ckpool_t *ckp, const char *blockhash) } stratum_broadcast_message(sdata, msg); free(msg); - if (ckp->remote) - upstream_block(ckp, height, workername, diff); free(workername);