From df7d17f3a97f4176d25533d39574ea3dd7cf93c7 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 24 Feb 2015 00:00:49 +1100 Subject: [PATCH] Ensure we use int64 for internal jobid throughout and add the string to debug message from the upstream pool --- src/generator.c | 8 +++++--- src/stratifier.c | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/generator.c b/src/generator.c index 0c2656b5..e649d8c3 100644 --- a/src/generator.c +++ b/src/generator.c @@ -792,7 +792,7 @@ static bool parse_notify(ckpool_t *ckp, proxy_instance_t *proxi, json_t *val) const char *prev_hash, *bbversion, *nbit, *ntime; proxy_instance_t *proxy = proxi->parent; gdata_t *gdata = proxi->ckp->data; - char *coinbase1, *coinbase2; + char *coinbase1, *coinbase2, *buf; bool clean, ret = false; notify_instance_t *ni; json_t *arr, *job_id; @@ -824,6 +824,8 @@ static bool parse_notify(ckpool_t *ckp, proxy_instance_t *proxi, json_t *val) LOGDEBUG("Received new notify from proxy %d:%d", proxi->id, proxi->subid); ni = ckzalloc(sizeof(notify_instance_t)); ni->jobid = job_id; + buf = json_string_value(job_id); + LOGDEBUG("JobID %s", buf); ni->coinbase1 = coinbase1; LOGDEBUG("Coinbase1 %s", coinbase1); ni->coinb1len = strlen(coinbase1) / 2; @@ -1484,7 +1486,7 @@ static void *proxy_send(void *arg) stratum_msg_t *msg; bool ret = true; json_t *val; - int id; + int64_t id; tv_t now; ts_t abs; @@ -1510,7 +1512,7 @@ static void *proxy_send(void *arg) continue; json_get_int(&subid, msg->json_msg, "subproxy"); - json_get_int(&id, msg->json_msg, "jobid"); + json_get_int64(&id, msg->json_msg, "jobid"); json_get_int(&proxyid, msg->json_msg, "proxy"); json_get_int64(&client_id, msg->json_msg, "client_id"); if (unlikely(proxyid != proxy->id)) { diff --git a/src/stratifier.c b/src/stratifier.c index db04833a..19e2896f 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1367,7 +1367,7 @@ static void update_notify(ckpool_t *ckp, const char *cmd) wb->ckp = ckp; wb->proxy = true; - json_int64cpy(&wb->id, val, "jobid"); + json_get_int64(&wb->id, val, "jobid"); json_strcpy(wb->prevhash, val, "prevhash"); json_intcpy(&wb->coinb1len, val, "coinb1len"); wb->coinb1bin = ckalloc(wb->coinb1len); @@ -3513,7 +3513,7 @@ static void submit_share(stratum_instance_t *client, const int64_t jobid, const char *msg; sprintf(enonce2, "%s%s", client->enonce1var, nonce2); - JSON_CPACK(json_msg, "{sisssssssIsisisi}", "jobid", jobid, "nonce2", enonce2, + JSON_CPACK(json_msg, "{sIsssssssIsisisi}", "jobid", jobid, "nonce2", enonce2, "ntime", ntime, "nonce", nonce, "client_id", client->id, "msg_id", msg_id, "proxy", client->proxyid, "subproxy", client->subproxyid);