Browse Source

Bugfix: Escape main prime loop for work restarts too

Luke Dashjr 12 years ago
parent
commit
1a371e204a
1 changed files with 6 additions and 1 deletions
  1. 6 1
      prime.c

+ 6 - 1
prime.c

@@ -884,6 +884,11 @@ bool prime(struct thr_info *thr, uint8_t *header, struct work *work)
 			rv = true;
 			break;
 		}
+		if (unlikely(thr->work_restart))
+		{
+			applog(LOG_DEBUG, "prime interrupted by work restart");
+			break;
+		}
 		mpz_clear(bnFixedMultiplier);
 		nRoundTests += nTests;
 		nRoundPrimesHit += nPrimesHit;
@@ -923,7 +928,7 @@ bool prime(struct thr_info *thr, uint8_t *header, struct work *work)
 // 	    boost::this_thread::interruption_point();
 // 	    if (vNodes.empty())
 // 	        break;
-	    if (fNewBlock /*|| pblock->nNonce >= 0xffff0000*/)
+	    if (fNewBlock || thr->work_restart /*|| pblock->nNonce >= 0xffff0000*/)
 	        break;
 // 	    if (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60)
 // 	        break;