Browse Source

x6500: Try nonce with previous work if it is wrong for current

Luke Dashjr 13 years ago
parent
commit
d1d895b30d
1 changed files with 8 additions and 0 deletions
  1. 8 0
      driver-x6500.c

+ 8 - 0
driver-x6500.c

@@ -169,6 +169,7 @@ static bool x6500_prepare(struct thr_info *thr)
 
 
 struct x6500_fpga_data {
 struct x6500_fpga_data {
 	struct jtag_port jtag;
 	struct jtag_port jtag;
+	struct work prevwork;
 };
 };
 
 
 #define bailout2(...) do {  \
 #define bailout2(...) do {  \
@@ -406,6 +407,11 @@ int64_t x6500_process_results(struct thr_info *thr, struct work *work)
 				applog(LOG_DEBUG, "%s %u.%u: Nonce for current  work: %08lx",
 				applog(LOG_DEBUG, "%s %u.%u: Nonce for current  work: %08lx",
 				       x6500->api->name, x6500->device_id, fpgaid,
 				       x6500->api->name, x6500->device_id, fpgaid,
 				       (unsigned long)nonce);
 				       (unsigned long)nonce);
+			} else if (test_nonce(&fpga->prevwork, nonce, false)) {
+				submit_nonce(thr, &fpga->prevwork, nonce);
+				applog(LOG_DEBUG, "%s %u.%u: Nonce for PREVIOUS work: %08lx",
+				       x6500->api->name, x6500->device_id, fpgaid,
+				       (unsigned long)nonce);
 			} else {
 			} else {
 				applog(LOG_DEBUG, "%s %u.%u: Nonce with H not zero  : %08lx",
 				applog(LOG_DEBUG, "%s %u.%u: Nonce with H not zero  : %08lx",
 				       x6500->api->name, x6500->device_id, fpgaid,
 				       x6500->api->name, x6500->device_id, fpgaid,
@@ -421,6 +427,8 @@ int64_t x6500_process_results(struct thr_info *thr, struct work *work)
 			break;
 			break;
 	}
 	}
 
 
+	memcpy(&fpga->prevwork, work, sizeof(fpga->prevwork));
+
 	return 0xffffffff;
 	return 0xffffffff;
 }
 }