mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-24 05:24:23 +00:00
Apply immediately the first set_difficulty
This is a workaround for pool, who send the first difficulty after notify
This commit is contained in:
parent
c855a8d2d2
commit
7c9fe7112e
16
util.c
16
util.c
@ -1560,7 +1560,9 @@ static bool parse_notify(struct pool *pool, json_t *val)
|
|||||||
pool->swork.nbit = nbit;
|
pool->swork.nbit = nbit;
|
||||||
pool->swork.ntime = ntime;
|
pool->swork.ntime = ntime;
|
||||||
pool->swork.clean = clean;
|
pool->swork.clean = clean;
|
||||||
pool->swork.diff = pool->next_diff;
|
if (pool->next_diff > 0) {
|
||||||
|
pool->swork.diff = pool->next_diff;
|
||||||
|
}
|
||||||
alloc_len = pool->swork.cb_len = cb1_len + pool->n1_len + pool->n2size + cb2_len;
|
alloc_len = pool->swork.cb_len = cb1_len + pool->n1_len + pool->n2size + cb2_len;
|
||||||
pool->nonce2_offset = cb1_len + pool->n1_len;
|
pool->nonce2_offset = cb1_len + pool->n1_len;
|
||||||
|
|
||||||
@ -1669,8 +1671,13 @@ static bool parse_diff(struct pool *pool, json_t *val)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
cg_wlock(&pool->data_lock);
|
cg_wlock(&pool->data_lock);
|
||||||
old_diff = pool->next_diff;
|
if (pool->next_diff > 0) {
|
||||||
pool->next_diff = diff;
|
old_diff = pool->next_diff;
|
||||||
|
pool->next_diff = diff;
|
||||||
|
} else {
|
||||||
|
old_diff = pool->swork.diff;
|
||||||
|
pool->next_diff = pool->swork.diff = diff;
|
||||||
|
}
|
||||||
cg_wunlock(&pool->data_lock);
|
cg_wunlock(&pool->data_lock);
|
||||||
|
|
||||||
if (old_diff != diff) {
|
if (old_diff != diff) {
|
||||||
@ -2561,7 +2568,8 @@ out:
|
|||||||
if (!pool->stratum_url)
|
if (!pool->stratum_url)
|
||||||
pool->stratum_url = pool->sockaddr_url;
|
pool->stratum_url = pool->sockaddr_url;
|
||||||
pool->stratum_active = true;
|
pool->stratum_active = true;
|
||||||
pool->next_diff = pool->swork.diff = 1;
|
pool->next_diff = 0;
|
||||||
|
pool->swork.diff = 1;
|
||||||
if (opt_protocol) {
|
if (opt_protocol) {
|
||||||
applog(LOG_DEBUG, "%s confirmed mining.subscribe with extranonce1 %s extran2size %d",
|
applog(LOG_DEBUG, "%s confirmed mining.subscribe with extranonce1 %s extran2size %d",
|
||||||
get_pool_name(pool), pool->nonce1, pool->n2size);
|
get_pool_name(pool), pool->nonce1, pool->n2size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user