getblocktemplate: submit/coinbase

This commit is contained in:
pooler 2014-05-05 10:11:57 +02:00
parent 30fae0c342
commit a9e64f41e7

View file

@ -350,9 +350,20 @@ static bool gbt_work_decode(const json_t *val, struct work *work)
int tx_count, tx_size; int tx_count, tx_size;
unsigned char txc_vi[9]; unsigned char txc_vi[9];
unsigned char (*merkle_tree)[32] = NULL; unsigned char (*merkle_tree)[32] = NULL;
bool submit_coinbase = false;
json_t *tmp, *txa; json_t *tmp, *txa;
bool rc = false; 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"); tmp = json_object_get(val, "height");
if (!tmp || !json_is_integer(tmp)) { if (!tmp || !json_is_integer(tmp)) {
applog(LOG_ERR, "JSON invalid height"); applog(LOG_ERR, "JSON invalid height");
@ -487,8 +498,9 @@ static bool gbt_work_decode(const json_t *val, struct work *work)
free(tx); free(tx);
goto out; goto out;
} }
strcat(work->txs, tx_hex);
sha256d(merkle_tree[1 + i], tx, tx_size); sha256d(merkle_tree[1 + i], tx, tx_size);
if (!submit_coinbase)
strcat(work->txs, tx_hex);
} }
n = 1 + tx_count; n = 1 + tx_count;
while (n > 1) { while (n > 1) {