From a9e64f41e7611f293af36992cb60931a2b8b9d08 Mon Sep 17 00:00:00 2001 From: pooler Date: Mon, 5 May 2014 10:11:57 +0200 Subject: [PATCH] getblocktemplate: submit/coinbase --- cpu-miner.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cpu-miner.c b/cpu-miner.c index 35e8d3f..cf6d76c 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -350,9 +350,20 @@ static bool gbt_work_decode(const json_t *val, struct work *work) int tx_count, tx_size; unsigned char txc_vi[9]; unsigned char (*merkle_tree)[32] = NULL; + bool submit_coinbase = false; json_t *tmp, *txa; bool rc = false; + tmp = json_object_get(val, "mutable"); + if (tmp && json_is_array(tmp)) { + n = json_array_size(tmp); + for (i = 0; i < n; i++) { + const char *s = json_string_value(json_array_get(tmp, i)); + if (s && !strcmp(s, "submit/coinbase")) + submit_coinbase = true; + } + } + tmp = json_object_get(val, "height"); if (!tmp || !json_is_integer(tmp)) { applog(LOG_ERR, "JSON invalid height"); @@ -487,8 +498,9 @@ static bool gbt_work_decode(const json_t *val, struct work *work) free(tx); goto out; } - strcat(work->txs, tx_hex); sha256d(merkle_tree[1 + i], tx, tx_size); + if (!submit_coinbase) + strcat(work->txs, tx_hex); } n = 1 + tx_count; while (n > 1) {