Make submit_tested_work return a bool about whether it meets the work target 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
diff --git a/cgminer.c b/cgminer.c
index 8008939..8707732 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -6073,18 +6073,19 @@ static void update_work_stats(struct thr_info *thr, struct work *work)
}
/* To be used once the work has been tested to be meet diff1 and has had its
- * nonce adjusted. */
-void submit_tested_work(struct thr_info *thr, struct work *work)
+ * nonce adjusted. Returns true if the work target is met. */
+bool submit_tested_work(struct thr_info *thr, struct work *work)
{
struct work *work_out;
update_work_stats(thr, work);
if (!fulltest(work->hash, work->target)) {
applog(LOG_INFO, "Share above target");
- return;
+ return false;
}
work_out = copy_work(work);
submit_work_async(work_out);
+ return true;
}
/* Returns true if nonce for work was a valid share */
diff --git a/miner.h b/miner.h
index dad0b00..8d5d647 100644
--- a/miner.h
+++ b/miner.h
@@ -1341,7 +1341,7 @@ 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 bool test_nonce_diff(struct work *work, uint32_t nonce, double diff);
-extern void submit_tested_work(struct thr_info *thr, struct work *work);
+extern bool 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 bool submit_noffset_nonce(struct thr_info *thr, struct work *work, uint32_t nonce,
int noffset);