Commit 8697d6a2cedaf8a395e10f6ae392608ee9b400be

Con Kolivas 2012-08-16T10:16:58

Do the cheaper comparison first.

diff --git a/cgminer.c b/cgminer.c
index 059fc81..bb46f53 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2485,6 +2485,11 @@ static bool stale_work(struct work *work, bool share)
 	struct pool *pool;
 	int getwork_delay;
 
+	if (work->work_block != work_block) {
+		applog(LOG_DEBUG, "Work stale due to block mismatch");
+		return true;
+	}
+
 	/* Technically the rolltime should be correct but some pools
 	 * advertise a broken expire= that is lower than a meaningful
 	 * scantime */
@@ -2507,11 +2512,6 @@ static bool stale_work(struct work *work, bool share)
 		return true;
 	}
 
-	if (work->work_block != work_block) {
-		applog(LOG_DEBUG, "Work stale due to block mismatch");
-		return true;
-	}
-
 	if (opt_fail_only && !share && pool != current_pool() && !work->mandatory) {
 		applog(LOG_DEBUG, "Work stale due to fail only pool mismatch");
 		return true;