|
|
@ -1055,13 +1055,13 @@ static char *json_array_string(json_t *val, unsigned int entry) |
|
|
|
static bool parse_notify(struct pool *pool, json_t *val) |
|
|
|
static bool parse_notify(struct pool *pool, json_t *val) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char *job_id, *prev_hash, *coinbase1, *coinbase2, *bbversion, *nbit, *ntime; |
|
|
|
char *job_id, *prev_hash, *coinbase1, *coinbase2, *bbversion, *nbit, *ntime; |
|
|
|
|
|
|
|
bool clean, ret = false; |
|
|
|
int merkles, i; |
|
|
|
int merkles, i; |
|
|
|
json_t *arr; |
|
|
|
json_t *arr; |
|
|
|
bool clean; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arr = json_array_get(val, 4); |
|
|
|
arr = json_array_get(val, 4); |
|
|
|
if (!arr || !json_is_array(arr)) |
|
|
|
if (!arr || !json_is_array(arr)) |
|
|
|
return false; |
|
|
|
goto out; |
|
|
|
|
|
|
|
|
|
|
|
merkles = json_array_size(arr); |
|
|
|
merkles = json_array_size(arr); |
|
|
|
|
|
|
|
|
|
|
@ -1090,7 +1090,7 @@ static bool parse_notify(struct pool *pool, json_t *val) |
|
|
|
free(nbit); |
|
|
|
free(nbit); |
|
|
|
if (ntime) |
|
|
|
if (ntime) |
|
|
|
free(ntime); |
|
|
|
free(ntime); |
|
|
|
return false; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mutex_lock(&pool->pool_lock); |
|
|
|
mutex_lock(&pool->pool_lock); |
|
|
@ -1137,7 +1137,9 @@ static bool parse_notify(struct pool *pool, json_t *val) |
|
|
|
/* A notify message is the closest stratum gets to a getwork */ |
|
|
|
/* A notify message is the closest stratum gets to a getwork */ |
|
|
|
pool->getwork_requested++; |
|
|
|
pool->getwork_requested++; |
|
|
|
total_getworks++; |
|
|
|
total_getworks++; |
|
|
|
return true; |
|
|
|
ret = true; |
|
|
|
|
|
|
|
out: |
|
|
|
|
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static bool parse_diff(struct pool *pool, json_t *val) |
|
|
|
static bool parse_diff(struct pool *pool, json_t *val) |
|
|
@ -1241,8 +1243,11 @@ bool parse_method(struct pool *pool, char *s) |
|
|
|
if (!buf) |
|
|
|
if (!buf) |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
|
|
|
|
|
|
|
|
if (!strncasecmp(buf, "mining.notify", 13) && parse_notify(pool, params)) { |
|
|
|
if (!strncasecmp(buf, "mining.notify", 13)) { |
|
|
|
ret = true; |
|
|
|
if (parse_notify(pool, params)) |
|
|
|
|
|
|
|
pool->stratum_notify = ret = true; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
pool->stratum_notify = ret = false; |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1308,6 +1313,10 @@ bool auth_stratum(struct pool *pool) |
|
|
|
|
|
|
|
|
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!pool->stratum_notify) |
|
|
|
|
|
|
|
goto out; |
|
|
|
|
|
|
|
|
|
|
|
ret = true; |
|
|
|
ret = true; |
|
|
|
applog(LOG_INFO, "Stratum authorisation success for pool %d", pool->pool_no); |
|
|
|
applog(LOG_INFO, "Stratum authorisation success for pool %d", pool->pool_no); |
|
|
|
pool->probed = true; |
|
|
|
pool->probed = true; |
|
|
|