mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Change mining.set_extranonce method as stratum notification
This commit is contained in:
parent
281bcd75e9
commit
e1dcbfab15
15
util.c
15
util.c
@ -1668,18 +1668,13 @@ static bool parse_extranonce(struct pool *pool, json_t *val)
|
|||||||
{
|
{
|
||||||
char s[RBUFSIZE], *nonce1;
|
char s[RBUFSIZE], *nonce1;
|
||||||
int n2size;
|
int n2size;
|
||||||
int id = json_integer_value(json_object_get(val, "id"));
|
|
||||||
json_t *params = json_object_get(val, "params");
|
|
||||||
|
|
||||||
if (!id)
|
nonce1 = json_array_string(val, 0);
|
||||||
return false;
|
|
||||||
|
|
||||||
nonce1 = json_array_string(params, 0);
|
|
||||||
if (!nonce1) {
|
if (!nonce1) {
|
||||||
// applog(LOG_INFO, "Failed to get nonce1 in ");
|
// applog(LOG_INFO, "Failed to get nonce1 in ");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
n2size = json_integer_value(json_array_get(params, 1));
|
n2size = json_integer_value(json_array_get(val, 1));
|
||||||
if (!n2size) {
|
if (!n2size) {
|
||||||
// applog(LOG_INFO, "Failed to get n2size in ");
|
// applog(LOG_INFO, "Failed to get n2size in ");
|
||||||
free(nonce1);
|
free(nonce1);
|
||||||
@ -1697,10 +1692,6 @@ static bool parse_extranonce(struct pool *pool, json_t *val)
|
|||||||
pool->n2size = n2size;
|
pool->n2size = n2size;
|
||||||
cg_wunlock(&pool->data_lock);
|
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));
|
applog(LOG_NOTICE, "%s coin change requested", get_pool_name(pool));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1849,7 +1840,7 @@ bool parse_method(struct pool *pool, char *s)
|
|||||||
return ret;
|
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;
|
ret = true;
|
||||||
json_decref(val);
|
json_decref(val);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user