Browse Source

Merge pull request #1 from bitbandi/diffbug

store the next difficulty
windows
bitbandi 9 years ago
parent
commit
34c1ff9fb2
  1. 1
      miner.h
  2. 7
      util.c

1
miner.h

@ -1306,6 +1306,7 @@ struct pool { @@ -1306,6 +1306,7 @@ struct pool {
unsigned char *coinbase;
size_t nonce2_offset;
unsigned char header_bin[128];
double next_diff;
int merkle_offset;
struct timeval tv_lastwork;

7
util.c

@ -1550,6 +1550,7 @@ static bool parse_notify(struct pool *pool, json_t *val) @@ -1550,6 +1550,7 @@ static bool parse_notify(struct pool *pool, json_t *val)
pool->swork.nbit = nbit;
pool->swork.ntime = ntime;
pool->swork.clean = clean;
pool->swork.diff = pool->next_diff;
alloc_len = pool->swork.cb_len = cb1_len + pool->n1_len + pool->n2size + cb2_len;
pool->nonce2_offset = cb1_len + pool->n1_len;
@ -1647,8 +1648,8 @@ static bool parse_diff(struct pool *pool, json_t *val) @@ -1647,8 +1648,8 @@ static bool parse_diff(struct pool *pool, json_t *val)
return false;
cg_wlock(&pool->data_lock);
old_diff = pool->swork.diff;
pool->swork.diff = diff;
old_diff = pool->next_diff;
pool->next_diff = diff;
cg_wunlock(&pool->data_lock);
if (old_diff != diff) {
@ -2531,7 +2532,7 @@ out: @@ -2531,7 +2532,7 @@ out:
if (!pool->stratum_url)
pool->stratum_url = pool->sockaddr_url;
pool->stratum_active = true;
pool->swork.diff = 1;
pool->next_diff = pool->swork.diff = 1;
if (opt_protocol) {
applog(LOG_DEBUG, "%s confirmed mining.subscribe with extranonce1 %s extran2size %d",
get_pool_name(pool), pool->nonce1, pool->n2size);

Loading…
Cancel
Save