From 51ab4af26f82cae13f8c89d27ba0a572ce202515 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 24 Dec 2016 09:27:42 +1100 Subject: [PATCH] Send remote workinfos to ckdb. --- src/stratifier.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index 72029452..73b3c1de 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1578,9 +1578,10 @@ out_unlock: return ret; } -static void add_remote_base(ckpool_t *ckp, sdata_t *sdata, workbase_t *wb) +static void add_remote_base(ckpool_t *ckp, sdata_t *sdata, workbase_t *wb, const json_t *wb_val) { workbase_t *tmp, *tmpa; + json_t *val; ts_realtime(&wb->gentime); @@ -1606,6 +1607,11 @@ static void add_remote_base(ckpool_t *ckp, sdata_t *sdata, workbase_t *wb) } HASH_ADD_I64(sdata->remote_workbases, id, wb); ck_wunlock(&sdata->workbase_lock); + + val = json_deep_copy(wb_val); + /* Replace workinfoid with mapped id */ + json_set_int64(val, "workinfoid", wb->mapped_id); + ckdbq_add(ckp, ID_WORKINFO, val); } static void add_node_base(ckpool_t *ckp, json_t *val, bool trusted) @@ -1687,7 +1693,7 @@ static void add_node_base(ckpool_t *ckp, json_t *val, bool trusted) /* If this is from a remote trusted server, add it to the * remote_workbases hashtable */ if (trusted) - add_remote_base(ckp, sdata, wb); + add_remote_base(ckp, sdata, wb, val); else add_base(ckp, sdata, wb, &new_block); if (new_block)