Commit ac0d303075e22f9d3d829ef01d7b6e7a97179fa3

Con Kolivas 2011-09-29T09:46:32

Don't make donation work interfere with block change detection allowing donation to work regardless of the block chain we're mining on.

diff --git a/main.c b/main.c
index 031b87c..21c515e 100644
--- a/main.c
+++ b/main.c
@@ -2502,6 +2502,10 @@ static bool stale_work(struct work *work)
 	if ((now.tv_sec - work->tv_staged.tv_sec) >= opt_scantime)
 		return true;
 
+	/* Don't compare donor work in case it's on a different chain */
+	if (donor(work->pool))
+		return ret;
+
 	hexstr = bin2hex(work->data, 18);
 	if (unlikely(!hexstr)) {
 		applog(LOG_ERR, "submit_work_thread OOM");
@@ -2766,6 +2770,11 @@ static void test_work_current(struct work *work, bool longpoll)
 	struct block *s;
 	char *hexstr;
 
+	/* Allow donation to not set current work, so it will work even if
+	 * mining on a different chain */
+	if (donor(work->pool))
+		return;
+
 	hexstr = bin2hex(work->data, 18);
 	if (unlikely(!hexstr)) {
 		applog(LOG_ERR, "stage_thread OOM");