Commit 50504ef9e01b0235e1b3184b6a82c158e89d2b9a

Con Kolivas 2011-08-14T13:57:58

If a work item has had any mining done on it, don't consider it discarded work.

diff --git a/main.c b/main.c
index 27f1e9c..ed06c09 100644
--- a/main.c
+++ b/main.c
@@ -2358,7 +2358,7 @@ static bool queue_request(struct thr_info *thr, bool needed)
 
 static void discard_work(struct work *work)
 {
-	if (!work->clone && !work->rolls) {
+	if (!work->clone && !work->rolls && !work->mined) {
 		if (work->pool)
 			work->pool->discarded_work++;
 		total_discarded++;
@@ -2583,6 +2583,8 @@ out:
 
 	work->thr_id = thr_id;
 	thread_reportin(thr);
+	if (ret)
+		work->mined = true;
 	return ret;
 }
 
diff --git a/miner.h b/miner.h
index de35033..f26df4d 100644
--- a/miner.h
+++ b/miner.h
@@ -342,6 +342,7 @@ struct work {
 	int		thr_id;
 	struct pool	*pool;
 	struct timeval	tv_staged;
+	bool		mined;
 	bool		clone;
 	bool		cloned;
 	bool		rolltime;