Use longpolls from backup pools with failover-only enabled just to check for block changes, but don't use them as work.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/cgminer.c b/cgminer.c
index 0e6be11..e78fe70 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -3798,10 +3798,6 @@ static void convert_to_work(json_t *val, bool rolltime, struct pool *pool)
struct work *work, *work_clone;
bool rc;
- /* Don't use as work if we have failover-only enabled */
- if (pool != cp && opt_fail_only)
- return;
-
work = make_work();
rc = work_decode(json_object_get(val, "result"), work);
@@ -3814,7 +3810,7 @@ static void convert_to_work(json_t *val, bool rolltime, struct pool *pool)
work->rolltime = rolltime;
/* Only flag this as longpoll work if the pool is the current pool */
- if (pool == cp)
+ if (pool == current_pool())
work->longpoll = true;
/* We'll be checking this work item twice, but we already know it's
@@ -3823,6 +3819,12 @@ static void convert_to_work(json_t *val, bool rolltime, struct pool *pool)
* allows testwork to know whether LP discovered the block or not. */
test_work_current(work);
+ /* Don't use as work if we have failover-only enabled */
+ if (!work->longpoll && opt_fail_only) {
+ free_work(work);
+ return;
+ }
+
work_clone = make_work();
memcpy(work_clone, work, sizeof(struct work));
while (reuse_work(work)) {