Commit e93f679ae4f0a1320a3a68d20b07f43b34f1a7bf

Con Kolivas 2012-09-30T23:44:27

Use the current pool when deciding whether to reuse work from a stratum source rather than the work's previous pool.

diff --git a/cgminer.c b/cgminer.c
index 5751e1f..65ea5d4 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4370,11 +4370,11 @@ static struct work *hash_pop(const struct timespec *abstime)
 	return work;
 }
 
-static bool reuse_work(struct work *work)
+static bool reuse_work(struct work *work, struct pool *pool)
 {
-	if (work->stratum && !work->pool->idle) {
+	if (pool->has_stratum) {
 		applog(LOG_DEBUG, "Reusing stratum work");
-		gen_stratum_work(work->pool, work);;
+		gen_stratum_work(pool, work);;
 		return true;
 	}
 
@@ -4545,7 +4545,7 @@ static void get_work(struct work *work, struct thr_info *thr, const int thr_id)
 retry:
 	pool = current_pool();
 
-	if (reuse_work(work))
+	if (reuse_work(work, pool))
 		goto out;
 
 	if (!pool->lagging && !total_staged() && global_queued() >= mining_threads + opt_queue) {