diff --git a/miner.h b/miner.h index be1be447..f7227e4a 100644 --- a/miner.h +++ b/miner.h @@ -1175,6 +1175,7 @@ struct pool { char *name; char *description; int prio; + bool extranonce_subscribe; int accepted, rejected; int seq_rejects; int seq_getfails; diff --git a/sgminer.c b/sgminer.c index e3854ad3..d827c285 100644 --- a/sgminer.c +++ b/sgminer.c @@ -151,7 +151,6 @@ bool opt_api_network; bool opt_delaynet; bool opt_disable_pool; bool opt_disable_client_reconnect = false; -bool opt_extranonce_subscribe = true; static bool no_work; bool opt_worktime; #if defined(HAVE_LIBCURL) && defined(CURL_HAS_KEEPALIVE) @@ -563,6 +562,7 @@ struct pool *add_pool(void) pool->rpc_proxy = NULL; pool->quota = 1; adjust_quota_gcd(); + pool->extranonce_subscribe = true; pool->description = ""; @@ -951,6 +951,16 @@ static char *set_userpass(const char *arg) return NULL; } +static char *set_no_extranonce_subscribe(char *arg) +{ + struct pool *pool = get_current_pool(); + + applog(LOG_DEBUG, "Disable extranonce subscribe on %d", pool->pool_no); + opt_set_invbool(&pool->extranonce_subscribe); + + return NULL; +} + static char *set_pool_priority(char *arg) { struct pool *pool = get_current_pool(); @@ -1329,7 +1339,7 @@ static struct opt_table opt_config_table[] = { opt_set_invbool, &opt_submit_stale, "Don't submit shares if they are detected as stale"), OPT_WITHOUT_ARG("--no-extranonce-subscribe", - opt_set_invbool, &opt_extranonce_subscribe, + set_no_extranonce_subscribe, NULL, "Disable 'extranonce' stratum subscribe"), OPT_WITH_ARG("--pass|-p", set_pass, NULL, NULL, @@ -4292,6 +4302,8 @@ void write_config(FILE *fcfg) pool->rpc_proxy ? "|" : "", json_escape(pool->rpc_url)); } + if (!pool->extranonce_subscribe) + fputs("\n\t\t\"no-extranonce-subscribe\" : true,", fcfg); fprintf(fcfg, "\n\t\t\"user\" : \"%s\",", json_escape(pool->rpc_user)); fprintf(fcfg, "\n\t\t\"pass\" : \"%s\",", json_escape(pool->rpc_pass)); /* Using get_pool_name() here is unsafe if opt_incognito is true. */ @@ -5677,7 +5689,7 @@ retry_stratum: bool init = pool_tset(pool, &pool->stratum_init); if (!init) { - bool ret = initiate_stratum(pool) && (!opt_extranonce_subscribe || subscribe_extranonce(pool)) && auth_stratum(pool); + bool ret = initiate_stratum(pool) && (!pool->extranonce_subscribe || subscribe_extranonce(pool)) && auth_stratum(pool); if (ret) init_stratum_threads(pool); diff --git a/util.c b/util.c index a7e2432e..690c589d 100644 --- a/util.c +++ b/util.c @@ -2566,7 +2566,7 @@ bool restart_stratum(struct pool *pool) suspend_stratum(pool); if (!initiate_stratum(pool)) return false; - if (opt_extranonce_subscribe && !subscribe_extranonce(pool)) + if (pool->extranonce_subscribe && !subscribe_extranonce(pool)) return false; if (!auth_stratum(pool)) return false;