Merge branch 'master' into segwit

This commit is contained in:
Luke Dashjr
2016-07-26 03:13:43 +00:00
3 changed files with 43 additions and 1 deletions

View File

@@ -302,6 +302,7 @@ const char *blktmpl_add_jansson(blktemplate_t *tmpl, const json_t *json, time_t
size_t txns = tmpl->txncount = json_array_size(v);
tmpl->txns = malloc(txns * sizeof(*tmpl->txns));
tmpl->txns_datasz = 0;
tmpl->txns_sigops = 0;
for (size_t i = 0; i < txns; ++i)
{
struct blktxn_t * const txn = &tmpl->txns[i];
@@ -309,6 +310,14 @@ const char *blktmpl_add_jansson(blktemplate_t *tmpl, const json_t *json, time_t
return s;
}
tmpl->txns_datasz += txn->datasz;
if (tmpl->txns_sigops == -1) {
; // Impossible to tally the unknown
} else if (txn->sigops_ == -1) {
tmpl->txns_sigops = -1;
} else {
tmpl->txns_sigops += txn->sigops_;
}
tmpl->txns_sigops += txn->sigops_;
}
if ((v = json_object_get(json, "coinbasetxn")) && json_is_object(v))