1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-23 04:54:26 +00:00

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

This commit is contained in:
Con Kolivas 2012-11-06 11:39:25 +11:00
parent 498882d829
commit a47a7886d5

View File

@ -5320,7 +5320,7 @@ static bool hashtest(struct thr_info *thr, struct work *work)
unsigned char hash2[32];
uint32_t *hash2_32 = (uint32_t *)hash2;
struct pool *pool = work->pool;
int i, diff;
int i;
for (i = 0; i < 80 / 4; i++)
swap32[i] = swab32(data32[i]);
@ -5346,11 +5346,15 @@ static bool hashtest(struct thr_info *thr, struct work *work)
}
if (work->stratum) {
int diff;
mutex_lock(&pool->pool_lock);
diff = pool->swork.diff;
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");
set_work_target(work, diff);
}