Browse Source

The max_nonce wasn't being reset on starting new work making cpu mining fail on each new work item.

Con Kolivas 14 years ago
parent
commit
fe8ab94a92
1 changed files with 2 additions and 1 deletions
  1. 2 1
      main.c

+ 2 - 1
main.c

@@ -1318,6 +1318,7 @@ static void *miner_thread(void *userdata)
 	struct thr_info *mythr = userdata;
 	struct thr_info *mythr = userdata;
 	const int thr_id = mythr->id;
 	const int thr_id = mythr->id;
 	uint32_t max_nonce = 0xffffff;
 	uint32_t max_nonce = 0xffffff;
+	unsigned long hashes_done = max_nonce;
 	bool needs_work = true;
 	bool needs_work = true;
 	/* Try to cycle approximately 5 times before each log update */
 	/* Try to cycle approximately 5 times before each log update */
 	const unsigned long cycle = opt_log_interval / 5 ? : 1;
 	const unsigned long cycle = opt_log_interval / 5 ? : 1;
@@ -1341,7 +1342,6 @@ static void *miner_thread(void *userdata)
 
 
 	while (1) {
 	while (1) {
 		struct work work __attribute__((aligned(128)));
 		struct work work __attribute__((aligned(128)));
-		unsigned long hashes_done;
 		struct timeval tv_workstart, tv_start, tv_end, diff;
 		struct timeval tv_workstart, tv_start, tv_end, diff;
 		uint64_t max64;
 		uint64_t max64;
 		bool rc;
 		bool rc;
@@ -1358,6 +1358,7 @@ static void *miner_thread(void *userdata)
 			work.thr_id = thr_id;
 			work.thr_id = thr_id;
 			needs_work = requested = false;
 			needs_work = requested = false;
 			work.blk.nonce = 0;
 			work.blk.nonce = 0;
+			max_nonce = hashes_done;
 		}
 		}
 		hashes_done = 0;
 		hashes_done = 0;
 		gettimeofday(&tv_start, NULL);
 		gettimeofday(&tv_start, NULL);