Meter out return of estimated hashes in BF1 to smooth out visible hashrate.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 58839ad..d56b80b 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -199,9 +199,8 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
{
struct cgpu_info *bitfury = thr->cgpu;
struct bitfury_info *info = bitfury->device_data;
- int64_t hashes = 0;
- char buf[45];
int amount, i;
+ char buf[45];
buf[0] = 'W';
memcpy(buf + 1, work->midstate, 32);
@@ -238,15 +237,15 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
memcpy(&nonce, info->buf + i + 3, 4);
nonce = decnonce(nonce);
if (bitfury_checkresults(thr, info->prevwork1, nonce)) {
- hashes += 0xffffffff;
+ info->nonces++;
continue;
}
if (bitfury_checkresults(thr, info->prevwork2, nonce)) {
- hashes += 0xffffffff;
+ info->nonces++;
continue;
}
if (bitfury_checkresults(thr, work, nonce)) {
- hashes += 0xffffffff;
+ info->nonces++;
continue;
}
}
@@ -256,7 +255,11 @@ cascade:
info->prevwork2 = info->prevwork1;
info->prevwork1 = copy_work(work);
work->blk.nonce = 0xffffffff;
- return hashes;
+ if (info->nonces) {
+ info->nonces--;
+ return (int64_t)0xffffffff;
+ }
+ return 0;
}
static void bitfury_flush_work(struct cgpu_info __maybe_unused *bitfury)
diff --git a/driver-bitfury.h b/driver-bitfury.h
index 96ec889..72bc267 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -21,6 +21,7 @@ struct bitfury_info {
struct work *prevwork2;
char buf[512];
int tot;
+ int nonces;
};
#endif /* BITFURY_H */