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 { @@ -1175,6 +1175,7 @@ struct pool {
char *name;
char *description;
int prio;
bool extranonce_subscribe;
int accepted, rejected;
int seq_rejects;
int seq_getfails;

18
sgminer.c

@ -151,7 +151,6 @@ bool opt_api_network; @@ -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) @@ -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) @@ -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[] = { @@ -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) @@ -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: @@ -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);

2
util.c

@ -2566,7 +2566,7 @@ bool restart_stratum(struct pool *pool) @@ -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;

Loading…
Cancel
Save