Read tmpl->target as an optional hash (breaks ABI)

This commit is contained in:
Luke Dashjr
2014-09-02 17:14:32 +00:00
parent 62b721ee15
commit f58db44275
3 changed files with 9 additions and 1 deletions

View File

@@ -241,6 +241,13 @@ const char *blktmpl_add_jansson(blktemplate_t *tmpl, const json_t *json, time_t
} }
} }
if ((v = json_object_get(json, "target")) && json_is_string(v))
{
tmpl->target = malloc(sizeof(*tmpl->target));
if (!my_hex2bin(tmpl->target, json_string_value(v), sizeof(*tmpl->target)))
return "Error decoding 'target'";
}
if ((v = json_object_get(json, "mutable")) && json_is_array(v)) if ((v = json_object_get(json, "mutable")) && json_is_array(v))
{ {
for (size_t i = json_array_size(v); i--; ) for (size_t i = json_array_size(v); i--; )

View File

@@ -121,6 +121,7 @@ void blktmpl_free(blktemplate_t *tmpl) {
blkaux_clean(&tmpl->auxs[i]); blkaux_clean(&tmpl->auxs[i]);
free(tmpl->auxs); free(tmpl->auxs);
free(tmpl->workid); free(tmpl->workid);
free(tmpl->target);
free(tmpl->lp.id); free(tmpl->lp.id);
free(tmpl->lp.uri); free(tmpl->lp.uri);
free(tmpl); free(tmpl);

View File

@@ -116,7 +116,7 @@ typedef struct {
// BIP 23: Basic Pool Extensions // BIP 23: Basic Pool Extensions
int16_t expires; int16_t expires;
blkhash_t target; blkhash_t *target;
// BIP 23: Mutations // BIP 23: Mutations
uint32_t mutations; uint32_t mutations;