1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-09 14:28:12 +00:00

Make submit_tested_work return a bool about whether it meets the work target or not.

This commit is contained in:
ckolivas 2014-01-24 17:07:39 +11:00 committed by Noel Maersk
parent a58ef1b8c7
commit d1e2bfaf7f
2 changed files with 5 additions and 4 deletions

View File

@ -1376,7 +1376,7 @@ extern void get_datestamp(char *, size_t, struct timeval *);
extern void inc_hw_errors(struct thr_info *thr); extern void inc_hw_errors(struct thr_info *thr);
extern bool test_nonce(struct work *work, uint32_t nonce); extern bool test_nonce(struct work *work, uint32_t nonce);
extern bool test_nonce_diff(struct work *work, uint32_t nonce, double diff); 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_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, extern bool submit_noffset_nonce(struct thr_info *thr, struct work *work, uint32_t nonce,
int noffset); int noffset);

View File

@ -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 /* To be used once the work has been tested to be meet diff1 and has had its
* nonce adjusted. */ * nonce adjusted. Returns true if the work target is met. */
void submit_tested_work(struct thr_info *thr, struct work *work) bool submit_tested_work(struct thr_info *thr, struct work *work)
{ {
struct work *work_out; struct work *work_out;
update_work_stats(thr, work); update_work_stats(thr, work);
if (!fulltest(work->hash, work->target)) { if (!fulltest(work->hash, work->target)) {
applog(LOG_INFO, "Share above target"); applog(LOG_INFO, "Share above target");
return; return false;
} }
work_out = copy_work(work); work_out = copy_work(work);
submit_work_async(work_out); submit_work_async(work_out);
return true;
} }
/* Returns true if nonce for work was a valid share */ /* Returns true if nonce for work was a valid share */