Commit 49eeaf4973e4b45a3d8b8e5991856b1532b03f37

Con Kolivas 2014-07-20T14:53:09

Make submit_nonce2_nonce return whether the share was valid or not

diff --git a/cgminer.c b/cgminer.c
index 3739118..53577f3 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -6849,13 +6849,14 @@ void set_target(unsigned char *dest_target, double diff)
 }
 
 #if defined (USE_AVALON2) || defined (USE_HASHRATIO)
-void submit_nonce2_nonce(struct thr_info *thr, struct pool *pool, struct pool *real_pool,
+bool submit_nonce2_nonce(struct thr_info *thr, struct pool *pool, struct pool *real_pool,
 			 uint32_t nonce2, uint32_t nonce)
 {
 	const int thr_id = thr->id;
 	struct cgpu_info *cgpu = thr->cgpu;
 	struct device_drv *drv = cgpu->drv;
 	struct work *work = make_work();
+	bool ret;
 
 	cg_wlock(&pool->data_lock);
 	pool->nonce2 = nonce2;
@@ -6869,10 +6870,11 @@ void submit_nonce2_nonce(struct thr_info *thr, struct pool *pool, struct pool *r
 	work->pool->works++;
 
 	work->mined = true;
-	work->device_diff = MIN(cgpu->drv->max_diff, work->work_difficulty);
+	work->device_diff = MIN(drv->max_diff, work->work_difficulty);
 
-	submit_nonce(thr, work, nonce);
+	ret = submit_nonce(thr, work, nonce);
 	free_work(work);
+	return ret;
 }
 #endif
 
diff --git a/miner.h b/miner.h
index f8db614..94e44f0 100644
--- a/miner.h
+++ b/miner.h
@@ -1094,7 +1094,7 @@ extern void clear_stratum_shares(struct pool *pool);
 extern void clear_pool_work(struct pool *pool);
 extern void set_target(unsigned char *dest_target, double diff);
 #if defined (USE_AVALON2) || defined (USE_HASHRATIO)
-void submit_nonce2_nonce(struct thr_info *thr, struct pool *pool, struct pool *real_pool,
+bool submit_nonce2_nonce(struct thr_info *thr, struct pool *pool, struct pool *real_pool,
 			 uint32_t nonce2, uint32_t nonce);
 #endif
 extern int restart_wait(struct thr_info *thr, unsigned int mstime);