Make submit_nonce return a bool for whether it's a valid share or not.
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
diff --git a/cgminer.c b/cgminer.c
index 07cd7d0..193a861 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -5565,13 +5565,15 @@ void inc_hw_errors(struct thr_info *thr)
thr->cgpu->drv->hw_error(thr);
}
-void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
+/* Returns true if nonce for work was a valid share */
+bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
{
uint32_t *work_nonce = (uint32_t *)(work->data + 64 + 12);
struct timeval tv_work_found;
unsigned char hash2[32];
uint32_t *hash2_32 = (uint32_t *)hash2;
uint32_t diff1targ;
+ bool ret = true;
thread_reportout(thr);
@@ -5594,6 +5596,7 @@ void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
thr->cgpu->drv->name, thr->cgpu->device_id);
inc_hw_errors(thr);
+ ret = false;
goto out;
}
@@ -5609,6 +5612,8 @@ void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
submit_work_async(work, &tv_work_found);
out:
thread_reportin(thr);
+
+ return ret;
}
static inline bool abandon_work(struct work *work, struct timeval *wdiff, uint64_t hashes)
diff --git a/miner.h b/miner.h
index d0f0726..6bfb754 100644
--- a/miner.h
+++ b/miner.h
@@ -1249,7 +1249,7 @@ struct modminer_fpga_state {
extern void get_datestamp(char *, struct timeval *);
extern void inc_hw_errors(struct thr_info *thr);
-extern void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
+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);
extern struct work *find_queued_work_bymidstate(struct cgpu_info *cgpu, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);