Browse Source

Move no-extranonce-subscribe parameter to a pool config

windows
elbandi 11 years ago
parent
commit
a32ec16169
  1. 1
      miner.h
  2. 18
      sgminer.c
  3. 2
      util.c

1
miner.h

@ -1175,6 +1175,7 @@ struct pool {
char *name; char *name;
char *description; char *description;
int prio; int prio;
bool extranonce_subscribe;
int accepted, rejected; int accepted, rejected;
int seq_rejects; int seq_rejects;
int seq_getfails; int seq_getfails;

18
sgminer.c

@ -151,7 +151,6 @@ bool opt_api_network;
bool opt_delaynet; bool opt_delaynet;
bool opt_disable_pool; bool opt_disable_pool;
bool opt_disable_client_reconnect = false; bool opt_disable_client_reconnect = false;
bool opt_extranonce_subscribe = true;
static bool no_work; static bool no_work;
bool opt_worktime; bool opt_worktime;
#if defined(HAVE_LIBCURL) && defined(CURL_HAS_KEEPALIVE) #if defined(HAVE_LIBCURL) && defined(CURL_HAS_KEEPALIVE)
@ -563,6 +562,7 @@ struct pool *add_pool(void)
pool->rpc_proxy = NULL; pool->rpc_proxy = NULL;
pool->quota = 1; pool->quota = 1;
adjust_quota_gcd(); adjust_quota_gcd();
pool->extranonce_subscribe = true;
pool->description = ""; pool->description = "";
@ -951,6 +951,16 @@ static char *set_userpass(const char *arg)
return NULL; 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) static char *set_pool_priority(char *arg)
{ {
struct pool *pool = get_current_pool(); struct pool *pool = get_current_pool();
@ -1329,7 +1339,7 @@ static struct opt_table opt_config_table[] = {
opt_set_invbool, &opt_submit_stale, opt_set_invbool, &opt_submit_stale,
"Don't submit shares if they are detected as stale"), "Don't submit shares if they are detected as stale"),
OPT_WITHOUT_ARG("--no-extranonce-subscribe", OPT_WITHOUT_ARG("--no-extranonce-subscribe",
opt_set_invbool, &opt_extranonce_subscribe, set_no_extranonce_subscribe, NULL,
"Disable 'extranonce' stratum subscribe"), "Disable 'extranonce' stratum subscribe"),
OPT_WITH_ARG("--pass|-p", OPT_WITH_ARG("--pass|-p",
set_pass, NULL, NULL, set_pass, NULL, NULL,
@ -4292,6 +4302,8 @@ void write_config(FILE *fcfg)
pool->rpc_proxy ? "|" : "", pool->rpc_proxy ? "|" : "",
json_escape(pool->rpc_url)); 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\"user\" : \"%s\",", json_escape(pool->rpc_user));
fprintf(fcfg, "\n\t\t\"pass\" : \"%s\",", json_escape(pool->rpc_pass)); fprintf(fcfg, "\n\t\t\"pass\" : \"%s\",", json_escape(pool->rpc_pass));
/* Using get_pool_name() here is unsafe if opt_incognito is true. */ /* 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); bool init = pool_tset(pool, &pool->stratum_init);
if (!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) if (ret)
init_stratum_threads(pool); init_stratum_threads(pool);

2
util.c

@ -2566,7 +2566,7 @@ bool restart_stratum(struct pool *pool)
suspend_stratum(pool); suspend_stratum(pool);
if (!initiate_stratum(pool)) if (!initiate_stratum(pool))
return false; return false;
if (opt_extranonce_subscribe && !subscribe_extranonce(pool)) if (pool->extranonce_subscribe && !subscribe_extranonce(pool))
return false; return false;
if (!auth_stratum(pool)) if (!auth_stratum(pool))
return false; return false;

Loading…
Cancel
Save