From d1e2bfaf7f8fa73121d2550b047d5e9ec3761f5e Mon Sep 17 00:00:00 2001 From: ckolivas Date: Fri, 24 Jan 2014 17:07:39 +1100 Subject: [PATCH] Make submit_tested_work return a bool about whether it meets the work target or not. --- miner.h | 2 +- sgminer.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/miner.h b/miner.h index 7f9285f4..c8ac8087 100644 --- a/miner.h +++ b/miner.h @@ -1376,7 +1376,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); diff --git a/sgminer.c b/sgminer.c index f1939159..0518ae68 100644 --- a/sgminer.c +++ b/sgminer.c @@ -6024,18 +6024,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 */