From e1dcbfab15db334620a8eca8f14c5cd2265a46b7 Mon Sep 17 00:00:00 2001 From: elbandi Date: Thu, 24 Apr 2014 20:38:37 +0200 Subject: [PATCH] Change mining.set_extranonce method as stratum notification --- util.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/util.c b/util.c index c6179c1f..8f0bcbf5 100644 --- a/util.c +++ b/util.c @@ -1668,18 +1668,13 @@ static bool parse_extranonce(struct pool *pool, json_t *val) { char s[RBUFSIZE], *nonce1; int n2size; - int id = json_integer_value(json_object_get(val, "id")); - json_t *params = json_object_get(val, "params"); - - if (!id) - return false; - nonce1 = json_array_string(params, 0); + nonce1 = json_array_string(val, 0); if (!nonce1) { // applog(LOG_INFO, "Failed to get nonce1 in "); return false; } - n2size = json_integer_value(json_array_get(params, 1)); + n2size = json_integer_value(json_array_get(val, 1)); if (!n2size) { // applog(LOG_INFO, "Failed to get n2size in "); free(nonce1); @@ -1697,10 +1692,6 @@ static bool parse_extranonce(struct pool *pool, json_t *val) pool->n2size = n2size; cg_wunlock(&pool->data_lock); - sprintf(s, "{\"id\": %d, \"result\": \"true\", \"error\": null}", id); - if (!stratum_send(pool, s, strlen(s))) - return false; - applog(LOG_NOTICE, "%s coin change requested", get_pool_name(pool)); return true; @@ -1849,7 +1840,7 @@ bool parse_method(struct pool *pool, char *s) return ret; } - if (!strncasecmp(buf, "mining.set_extranonce", 21) && parse_extranonce(pool, val)) { + if (!strncasecmp(buf, "mining.set_extranonce", 21) && parse_extranonce(pool, params)) { ret = true; json_decref(val); return ret;