From b606a60349fe2f1c1c56a1fec833ec849b798676 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 26 Sep 2013 21:20:59 +1000 Subject: [PATCH] Use submit_tested_work in bitfury driver to avoid unnecessarily re-testing the work for validity. --- driver-bitfury.c | 6 ++---- miner.h | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/driver-bitfury.c b/driver-bitfury.c index 44e90e0e..a5ca5630 100644 --- a/driver-bitfury.c +++ b/driver-bitfury.c @@ -168,13 +168,11 @@ const uint32_t bf_offsets[] = {0, -0x400000, -0x800000}; static bool bitfury_checkresults(struct thr_info *thr, struct work *work, uint32_t nonce) { - uint32_t offset_nonce; int i; for (i = 0; i < BT_OFFSETS; i++) { - offset_nonce = nonce + bf_offsets[i]; - if (test_nonce(work, offset_nonce)) { - submit_nonce(thr, work, offset_nonce); + if (test_nonce(work, nonce + bf_offsets[i])) { + submit_tested_work(thr, work); return true; } } diff --git a/miner.h b/miner.h index d8d41484..867ca0e6 100644 --- a/miner.h +++ b/miner.h @@ -1358,6 +1358,7 @@ struct modminer_fpga_state { extern void get_datestamp(char *, size_t, struct timeval *); extern void inc_hw_errors(struct thr_info *thr); extern bool test_nonce(struct work *work, uint32_t nonce); +extern void submit_tested_work(struct thr_info *thr, struct work *work); extern bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce); extern struct work *get_queued(struct cgpu_info *cgpu); extern struct work *__find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);