Luke Dashjr 12 years ago
parent
commit
1ab913b465
1 changed files with 4 additions and 1 deletions
  1. 4 1
      driver-avalonmm.c

+ 4 - 1
driver-avalonmm.c

@@ -164,6 +164,7 @@ static int decode_pkg(struct thr_info *thr, struct avalon2_ret *ar, uint8_t *pkg
 	unsigned int expected_crc;
 	unsigned int expected_crc;
 	unsigned int actual_crc;
 	unsigned int actual_crc;
 	uint32_t nonce, nonce2, miner, modular_id;
 	uint32_t nonce, nonce2, miner, modular_id;
+	void *xnonce2;
 	int pool_no;
 	int pool_no;
 	uint8_t job_id[5];
 	uint8_t job_id[5];
 	int tmp;
 	int tmp;
@@ -196,6 +197,8 @@ static int decode_pkg(struct thr_info *thr, struct avalon2_ret *ar, uint8_t *pkg
 		case AVA2_P_NONCE:
 		case AVA2_P_NONCE:
 			memcpy(&miner, ar->data + 0, 4);
 			memcpy(&miner, ar->data + 0, 4);
 			memcpy(&pool_no, ar->data + 4, 4);
 			memcpy(&pool_no, ar->data + 4, 4);
+			// FIXME: How is xnonce2sz > 4 handled?
+			xnonce2 = &ar->data[12 - work2d_xnonce2sz];
 			memcpy(&nonce2, ar->data + 8, 4);
 			memcpy(&nonce2, ar->data + 8, 4);
 			/* Calc time    ar->data + 12 */
 			/* Calc time    ar->data + 12 */
 			memcpy(&nonce, ar->data + 16, 4);
 			memcpy(&nonce, ar->data + 16, 4);
@@ -223,7 +226,7 @@ static int decode_pkg(struct thr_info *thr, struct avalon2_ret *ar, uint8_t *pkg
 				break;
 				break;
 
 
 			if (thr && !info->new_stratum)
 			if (thr && !info->new_stratum)
-				work2d_submit_nonce(thr, &info->swork, &info->tv_prepared, &nonce2, info->xnonce1, nonce, info->swork.ntime, NULL, 1.);
+				work2d_submit_nonce(thr, &info->swork, &info->tv_prepared, xnonce2, info->xnonce1, nonce, info->swork.ntime, NULL, 1.);
 			break;
 			break;
 		case AVA2_P_STATUS:
 		case AVA2_P_STATUS:
 			if (thr)
 			if (thr)