Browse Source

Only retarget stratum shares to new pool diff if diff has dropped.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
a47a7886d5
  1. 8
      cgminer.c

8
cgminer.c

@ -5320,7 +5320,7 @@ static bool hashtest(struct thr_info *thr, struct work *work)
unsigned char hash2[32]; unsigned char hash2[32];
uint32_t *hash2_32 = (uint32_t *)hash2; uint32_t *hash2_32 = (uint32_t *)hash2;
struct pool *pool = work->pool; struct pool *pool = work->pool;
int i, diff; int i;
for (i = 0; i < 80 / 4; i++) for (i = 0; i < 80 / 4; i++)
swap32[i] = swab32(data32[i]); swap32[i] = swab32(data32[i]);
@ -5346,11 +5346,15 @@ static bool hashtest(struct thr_info *thr, struct work *work)
} }
if (work->stratum) { if (work->stratum) {
int diff;
mutex_lock(&pool->pool_lock); mutex_lock(&pool->pool_lock);
diff = pool->swork.diff; diff = pool->swork.diff;
mutex_unlock(&pool->pool_lock); mutex_unlock(&pool->pool_lock);
if (unlikely(work->sdiff != diff)) { /* Retarget share only if pool diff has dropped since we
* generated this work */
if (unlikely(work->sdiff > diff)) {
applog(LOG_DEBUG, "Share needs retargetting to match pool"); applog(LOG_DEBUG, "Share needs retargetting to match pool");
set_work_target(work, diff); set_work_target(work, diff);
} }

Loading…
Cancel
Save