Browse Source

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

nfactor-troky
ckolivas 11 years ago committed by Noel Maersk
parent
commit
d1e2bfaf7f
  1. 2
      miner.h
  2. 7
      sgminer.c

2
miner.h

@ -1376,7 +1376,7 @@ extern void get_datestamp(char *, size_t, struct timeval *); @@ -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);

7
sgminer.c

@ -6024,18 +6024,19 @@ static void update_work_stats(struct thr_info *thr, struct work *work) @@ -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 */

Loading…
Cancel
Save