diff --git a/ckproxy.conf b/ckproxy.conf index fec5783a..5daddb5b 100644 --- a/ckproxy.conf +++ b/ckproxy.conf @@ -19,6 +19,7 @@ "mindiff" : 1, "startdiff" : 42, "maxdiff" : 0, +"clientsvspeed" : false, "logdir" : "logs" } Comments from here on are ignored. diff --git a/src/ckpool.c b/src/ckpool.c index de6d41c0..0d75cbab 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -1174,6 +1174,7 @@ static void parse_config(ckpool_t *ckp) if (arr_size) parse_proxies(ckp, arr_val, arr_size); } + json_get_bool(&ckp->clientsvspeed, json_conf, "clientsvspeed"); json_decref(json_conf); } diff --git a/src/ckpool.h b/src/ckpool.h index 5cb34f41..d5d2b710 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -139,6 +139,9 @@ struct ckpool_instance { /* Are we running as a proxy */ bool proxy; + /* Do we prefer more proxy clients over support for >5TH clients */ + bool clientsvspeed; + /* Are we running without ckdb */ bool standalone; diff --git a/src/stratifier.c b/src/stratifier.c index 1147e89a..47535b66 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -986,15 +986,27 @@ static void update_subscribe(ckpool_t *ckp) sdata->proxy_base.enonce1constlen = strlen(sdata->proxy_base.enonce1) / 2; hex2bin(sdata->proxy_base.enonce1bin, sdata->proxy_base.enonce1, sdata->proxy_base.enonce1constlen); sdata->proxy_base.nonce2len = json_integer_value(json_object_get(val, "nonce2len")); - if (sdata->proxy_base.nonce2len > 7) - sdata->proxy_base.enonce1varlen = 4; - else if (sdata->proxy_base.nonce2len > 5) - sdata->proxy_base.enonce1varlen = 2; - else - sdata->proxy_base.enonce1varlen = 1; + if (ckp->clientsvspeed) { + if (sdata->proxy_base.nonce2len > 5) + sdata->proxy_base.enonce1varlen = 4; + else if (sdata->proxy_base.nonce2len > 3) + sdata->proxy_base.enonce1varlen = 2; + else + sdata->proxy_base.enonce1varlen = 1; + } else { + if (sdata->proxy_base.nonce2len > 7) + sdata->proxy_base.enonce1varlen = 4; + else if (sdata->proxy_base.nonce2len > 5) + sdata->proxy_base.enonce1varlen = 2; + else + sdata->proxy_base.enonce1varlen = 1; + } sdata->proxy_base.enonce2varlen = sdata->proxy_base.nonce2len - sdata->proxy_base.enonce1varlen; ck_wunlock(&sdata->workbase_lock); + LOGNOTICE("Upstream pool extranonce2 length %d, max proxy clients %lld", + sdata->proxy_base.nonce2len, 1ll << (sdata->proxy_base.enonce1varlen * 8)); + json_decref(val); drop_allclients(ckp); }