Browse Source

stale_work: Don't factor getwork delay into expiry for shares (only for work itself)

Luke Dashjr 13 years ago
parent
commit
a98495d5f1
1 changed files with 4 additions and 2 deletions
  1. 4 2
      cgminer.c

+ 4 - 2
cgminer.c

@@ -2166,6 +2166,8 @@ static bool stale_work(struct work *work, bool share)
 	if (work->mandatory)
 		return false;
 
+	pool = work->pool;
+
 	if (share) {
 		/* Technically the rolltime should be correct but some pools
 		 * advertise a broken expire= that is lower than a meaningful
@@ -2180,9 +2182,7 @@ static bool stale_work(struct work *work, bool share)
 			work_expiry = (work->rolltime - opt_scantime) * 2 / 3 + opt_scantime;
 		else /* Shouldn't happen unless someone increases scantime */
 			work_expiry = opt_scantime;
-	}
 
-	pool = work->pool;
 	/* Factor in the average getwork delay of this pool, rounding it up to
 	 * the nearest second */
 	getwork_delay = pool->cgminer_pool_stats.getwork_wait_rolling * 5 + 1;
@@ -2190,6 +2190,8 @@ static bool stale_work(struct work *work, bool share)
 	if (unlikely(work_expiry < 5))
 		work_expiry = 5;
 
+	}
+
 	gettimeofday(&now, NULL);
 	if ((now.tv_sec - work->tv_staged.tv_sec) >= work_expiry)
 		return true;