Skip to content
This repository has been archived by the owner on Jan 9, 2021. It is now read-only.

Commit

Permalink
Merge pull request ckolivas#679 from bitbandi/diffbug
Browse files Browse the repository at this point in the history
store the next difficulty
  • Loading branch information
ckolivas committed Jul 20, 2015
2 parents 391dca6 + 661088e commit b2c6b72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions miner.h
Expand Up @@ -1338,6 +1338,7 @@ struct pool {
char bbversion[12];
char nbit[12];
char ntime[12];
double next_diff;
double sdiff;

struct timeval tv_lastwork;
Expand Down
7 changes: 4 additions & 3 deletions util.c
Expand Up @@ -2008,6 +2008,7 @@ static bool parse_notify(struct pool *pool, json_t *val)
snprintf(pool->nbit, 9, "%s", nbit);
snprintf(pool->ntime, 9, "%s", ntime);
pool->swork.clean = clean;
pool->sdiff = pool->next_diff;
alloc_len = pool->coinbase_len = cb1_len + pool->n1_len + pool->n2size + cb2_len;
pool->nonce2_offset = cb1_len + pool->n1_len;

Expand Down Expand Up @@ -2116,8 +2117,8 @@ static bool parse_diff(struct pool *pool, json_t *val)
return false;

cg_wlock(&pool->data_lock);
old_diff = pool->sdiff;
pool->sdiff = diff;
old_diff = pool->next_diff;
pool->next_diff = diff;
cg_wunlock(&pool->data_lock);

if (old_diff != diff) {
Expand Down Expand Up @@ -2915,7 +2916,7 @@ bool initiate_stratum(struct pool *pool)
if (!pool->stratum_url)
pool->stratum_url = pool->sockaddr_url;
pool->stratum_active = true;
pool->sdiff = 1;
pool->next_diff = pool->sdiff = 1;
if (opt_protocol) {
applog(LOG_DEBUG, "Pool %d confirmed mining.subscribe with extranonce1 %s extran2size %d",
pool->pool_no, pool->nonce1, pool->n2size);
Expand Down

0 comments on commit b2c6b72

Please sign in to comment.