Detect pools that have issues represented by endless rejected shares and disable them, with a parameter to optionally disable this feature.
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
diff --git a/cgminer.c b/cgminer.c
index dad5e9b..ddf0ebb 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -135,6 +135,7 @@ int opt_api_port = 4028;
bool opt_api_listen = false;
bool opt_api_network = false;
bool opt_delaynet = false;
+bool opt_disable_pool = true;
char *opt_kernel_path;
char *cgminer_path;
@@ -835,6 +836,9 @@ static struct opt_table opt_config_table[] = {
opt_hidden
#endif
),
+ OPT_WITHOUT_ARG("--no-pool-disable",
+ opt_set_invbool, &opt_disable_pool,
+ "Do not automatically disable pools that continually reject shares"),
OPT_WITHOUT_ARG("--no-restart",
opt_set_invbool, &opt_restart,
#ifdef HAVE_OPENCL
@@ -1653,6 +1657,7 @@ static bool submit_upstream_work(const struct work *work, CURL *curl)
cgpu->accepted++;
total_accepted++;
pool->accepted++;
+ pool->seq_rejects = 0;
cgpu->last_share_pool = pool->pool_no;
cgpu->last_share_pool_time = time(NULL);
applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)");
@@ -1674,6 +1679,7 @@ static bool submit_upstream_work(const struct work *work, CURL *curl)
cgpu->rejected++;
total_rejected++;
pool->rejected++;
+ pool->seq_rejects++;
applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)");
if (!QUIET) {
char where[17];
@@ -1704,6 +1710,22 @@ static bool submit_upstream_work(const struct work *work, CURL *curl)
hashshow, cgpu->api->name, cgpu->device_id, where, reason);
sharelog(disposition, work);
}
+
+ /* Once we have more than a nominal amount of sequential rejects,
+ * at least 10 and more than the current utility rate per minute,
+ * disable the pool because some pool error is likely to have
+ * ensued. */
+ if (pool->seq_rejects > 10 && opt_disable_pool && total_pools > 1) {
+ double utility = total_accepted / ( total_secs ? total_secs : 1 ) * 60;
+
+ if (pool->seq_rejects > utility) {
+ applog(LOG_WARNING, "Pool %d rejected %d sequential shares, disabling!",
+ pool->pool_no, pool->seq_rejects);
+ pool->enabled = false;
+ if (pool == current_pool())
+ switch_pools(NULL);
+ }
+ }
}
cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60;
diff --git a/miner.h b/miner.h
index 85d4e7a..27decf2 100644
--- a/miner.h
+++ b/miner.h
@@ -608,6 +608,7 @@ struct pool {
int pool_no;
int prio;
int accepted, rejected;
+ int seq_rejects;
bool submit_fail;
bool idle;