From 4ad62b9a78a1adfbff7850e2265076ad6e696199 Mon Sep 17 00:00:00 2001 From: elbandi Date: Thu, 24 Apr 2014 15:44:50 +0200 Subject: [PATCH] Allow disable extranonce subscribe --- miner.h | 1 + sgminer.c | 8 ++++++-- util.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/miner.h b/miner.h index 7db088fd..be1be447 100644 --- a/miner.h +++ b/miner.h @@ -1078,6 +1078,7 @@ extern int nDevs; extern int hw_errors; extern bool use_syslog; extern bool opt_quiet; +extern bool opt_extranonce_subscribe; extern struct thr_info *control_thr; extern struct thr_info **mining_thr; extern struct cgpu_info gpus[MAX_GPUDEVICES]; diff --git a/sgminer.c b/sgminer.c index 3bdfb030..0765cba8 100644 --- a/sgminer.c +++ b/sgminer.c @@ -151,6 +151,7 @@ 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) @@ -1327,6 +1328,9 @@ static struct opt_table opt_config_table[] = { OPT_WITHOUT_ARG("--no-submit-stale", 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, + "Disable 'extranonce' stratum subscribe"), OPT_WITH_ARG("--pass|-p", set_pass, NULL, NULL, "Password for bitcoin JSON-RPC server"), @@ -5207,7 +5211,7 @@ static bool parse_stratum_response(struct pool *pool, char *s) if (err_val && !json_is_null(err_val)) { char *ss; ss = (char *)json_string_value(json_array_get(err_val, 1)); - if (strcmp(ss, "Method 'subscribe' not found for service 'mining.extranonce'") == 0) { + if (opt_extranonce_subscribe && strcmp(ss, "Method 'subscribe' not found for service 'mining.extranonce'") == 0) { applog(LOG_INFO, "Cannot subscribe to mining.extranonce on %s", get_pool_name(pool)); goto out; } @@ -5682,7 +5686,7 @@ retry_stratum: bool init = pool_tset(pool, &pool->stratum_init); if (!init) { - bool ret = initiate_stratum(pool) && auth_stratum(pool) && subscribe_extranonce(pool); + bool ret = initiate_stratum(pool) && auth_stratum(pool) && (!opt_extranonce_subscribe || subscribe_extranonce(pool)); if (ret) init_stratum_threads(pool); diff --git a/util.c b/util.c index 0d08b585..5de9669c 100644 --- a/util.c +++ b/util.c @@ -2522,7 +2522,7 @@ bool restart_stratum(struct pool *pool) return false; if (!auth_stratum(pool)) return false; - if (!subscribe_extranonce(pool)) + if (opt_extranonce_subscribe && !subscribe_extranonce(pool)) return false; return true;