diff --git a/cgminer.c b/cgminer.c index dad5e9bd..ddf0ebb5 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 85d4e7a2..27decf2d 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;