From 78ba375ae5b51c11ef5125d94dc9669f157d57d1 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 2 Jan 2017 12:31:39 +1100 Subject: [PATCH] Send all transactions to new remote trusted servers. --- src/stratifier.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index 9886bea2..a877a076 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -6158,8 +6158,13 @@ static void send_node_all_txns(sdata_t *sdata, const stratum_instance_t *client) } ck_runlock(&sdata->workbase_lock); - JSON_CPACK(val, "{ss,so}", "node.method", stratum_msgs[SM_TRANSACTIONS], - "transaction", txn_array); + if (client->trusted) { + JSON_CPACK(val, "{ss,so}", "method", stratum_msgs[SM_TRANSACTIONS], + "transaction", txn_array); + } else { + JSON_CPACK(val, "{ss,so}", "node.method", stratum_msgs[SM_TRANSACTIONS], + "transaction", txn_array); + } msg = ckzalloc(sizeof(smsg_t)); msg->json_msg = val; msg->client_id = client->id; @@ -6206,7 +6211,11 @@ static void add_remote_server(sdata_t *sdata, stratum_instance_t *client) ck_wlock(&sdata->instance_lock); client->trusted = true; DL_APPEND(sdata->remote_instances, client); + __inc_instance_ref(client); ck_wunlock(&sdata->instance_lock); + + send_node_all_txns(sdata, client); + dec_instance_ref(sdata, client); } /* Enter with client holding ref count */