Browse Source

inc_hw_errors2: Support reporting hw errors without a known nonce

Luke Dashjr 12 years ago
parent
commit
64c008bd32
2 changed files with 9 additions and 2 deletions
  1. 8 2
      miner.c
  2. 1 0
      miner.h

+ 8 - 2
miner.c

@@ -8658,8 +8658,14 @@ void inc_hw_errors2(struct thr_info *thr, const struct work *work, const uint32_
 	struct cgpu_info * const cgpu = thr->cgpu;
 	
 	if (bad_nonce_p)
-		applog(LOG_DEBUG, "%"PRIpreprv": invalid nonce (%08lx) - HW error",
-		       cgpu->proc_repr, (unsigned long)be32toh(*bad_nonce_p));
+	{
+		if (bad_nonce_p == UNKNOWN_NONCE)
+			applog(LOG_DEBUG, "%"PRIpreprv": invalid nonce - HW error",
+			       cgpu->proc_repr);
+		else
+			applog(LOG_DEBUG, "%"PRIpreprv": invalid nonce (%08lx) - HW error",
+			       cgpu->proc_repr, (unsigned long)be32toh(*bad_nonce_p));
+	}
 	
 	mutex_lock(&stats_lock);
 	hw_errors++;

+ 1 - 0
miner.h

@@ -1404,6 +1404,7 @@ extern void stratum_work_cpy(struct stratum_work *dst, const struct stratum_work
 extern void stratum_work_clean(struct stratum_work *);
 extern void gen_stratum_work2(struct work *, struct stratum_work *, const char *nonce1);
 extern void inc_hw_errors2(struct thr_info *thr, const struct work *work, const uint32_t *bad_nonce_p);
+#define UNKNOWN_NONCE ((uint32_t*)inc_hw_errors2)
 extern void inc_hw_errors(struct thr_info *, const struct work *, const uint32_t bad_nonce);
 #define inc_hw_errors_only(thr)  inc_hw_errors(thr, NULL, 0)
 enum test_nonce2_result {