Browse Source

Merge commit '44736b3' into cg_merges_20130602

Conflicts:
	miner.c
	miner.h
Luke Dashjr 12 years ago
parent
commit
3fefc277f1
2 changed files with 7 additions and 2 deletions
  1. 6 1
      miner.c
  2. 1 1
      miner.h

+ 6 - 1
miner.c

@@ -7042,12 +7042,14 @@ enum test_nonce2_result _test_nonce2(struct work *work, uint32_t nonce, bool che
 	return hashtest2(work, checktarget);
 }
 
-void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
+/* Returns true if nonce for work was a valid share */
+bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
 {
 	uint32_t *work_nonce = (uint32_t *)(work->data + 64 + 12);
 	uint32_t bak_nonce = *work_nonce;
 	struct timeval tv_work_found;
 	enum test_nonce2_result res;
+	bool ret = true;
 
 	thread_reportout(thr);
 
@@ -7070,6 +7072,7 @@ void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
 			applog(LOG_WARNING, "%"PRIpreprv": invalid nonce - HW error",
 			       cgpu->proc_repr);
 			inc_hw_errors(thr);
+			ret = false;
 			goto out;
 		}
 	
@@ -7090,6 +7093,8 @@ void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
 out:
 	*work_nonce = bak_nonce;
 	thread_reportin(thr);
+
+	return ret;
 }
 
 bool abandon_work(struct work *work, struct timeval *wdiff, uint64_t hashes)

+ 1 - 1
miner.h

@@ -1242,7 +1242,7 @@ enum test_nonce2_result {
 extern enum test_nonce2_result _test_nonce2(struct work *, uint32_t nonce, bool checktarget);
 #define test_nonce(work, nonce, checktarget)  (_test_nonce2(work, nonce, checktarget) == TNR_GOOD)
 #define test_nonce2(work, nonce)  (_test_nonce2(work, nonce, true))
-extern void 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 struct work *get_queued(struct cgpu_info *cgpu);
 extern struct work *__find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);
 extern struct work *find_queued_work_bymidstate(struct cgpu_info *cgpu, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);