Browse Source

Bugfix: avalon2: Save a copy of struct stratum_work that we are processing

Luke Dashjr 12 years ago
parent
commit
385a9dc25e
2 changed files with 4 additions and 6 deletions
  1. 3 6
      driver-avalonmm.c
  2. 1 0
      driver-avalonmm.h

+ 3 - 6
driver-avalonmm.c

@@ -160,7 +160,6 @@ static int decode_pkg(struct thr_info *thr, struct avalon2_ret *ar, uint8_t *pkg
 {
 	struct cgpu_info *avalon2 = NULL;
 	struct avalon2_info *info = NULL;
-	struct pool *pool;
 
 	unsigned int expected_crc;
 	unsigned int actual_crc;
@@ -222,14 +221,11 @@ static int decode_pkg(struct thr_info *thr, struct avalon2_ret *ar, uint8_t *pkg
 
 			applog(LOG_DEBUG, "Avalon2: Found! [%s] %d:(%08x) (%08x)",
 			       job_id, pool_no, nonce2, nonce);
-			/* FIXME:
-			 * We need remember the pre_pool. then submit the stale work */
-			pool = pools[pool_no];
-			if (job_idcmp(job_id, pool->swork.job_id))
+			if (job_idcmp(job_id, info->swork.job_id))
 				break;
 
 			if (thr && !info->new_stratum)
-				work2d_submit_nonce(thr, &pool->swork, &info->tv_prepared, xnonce2, info->xnonce1, nonce, pool->swork.ntime, NULL, 1.);
+				work2d_submit_nonce(thr, &info->swork, &info->tv_prepared, xnonce2, info->xnonce1, nonce, info->swork.ntime, NULL, 1.);
 			break;
 		case AVA2_P_STATUS:
 			if (thr)
@@ -492,6 +488,7 @@ static int avalon2_stratum_pkgs(int fd, struct pool *pool, struct thr_info *thr)
 	}
 	
 	timer_set_now(&info->tv_prepared);
+	stratum_work_cpy(&info->swork, &pool->swork);
 	
 	return 0;
 }

+ 1 - 0
driver-avalonmm.h

@@ -115,6 +115,7 @@ struct avalon2_info {
 	char mm_version[AVA2_DEFAULT_MODULARS][16];
 	
 	struct timeval tv_prepared;
+	struct stratum_work swork;
 };
 
 #define AVA2_WRITE_SIZE (sizeof(struct avalon2_pkg))