Browse Source

Add config option to prioritise more clients than supporting clients with high hashrates

master
Con Kolivas 10 years ago
parent
commit
b1218a7cf0
  1. 1
      ckproxy.conf
  2. 1
      src/ckpool.c
  3. 3
      src/ckpool.h
  4. 24
      src/stratifier.c

1
ckproxy.conf

@ -19,6 +19,7 @@
"mindiff" : 1, "mindiff" : 1,
"startdiff" : 42, "startdiff" : 42,
"maxdiff" : 0, "maxdiff" : 0,
"clientsvspeed" : false,
"logdir" : "logs" "logdir" : "logs"
} }
Comments from here on are ignored. Comments from here on are ignored.

1
src/ckpool.c

@ -1174,6 +1174,7 @@ static void parse_config(ckpool_t *ckp)
if (arr_size) if (arr_size)
parse_proxies(ckp, arr_val, arr_size); parse_proxies(ckp, arr_val, arr_size);
} }
json_get_bool(&ckp->clientsvspeed, json_conf, "clientsvspeed");
json_decref(json_conf); json_decref(json_conf);
} }

3
src/ckpool.h

@ -139,6 +139,9 @@ struct ckpool_instance {
/* Are we running as a proxy */ /* Are we running as a proxy */
bool proxy; bool proxy;
/* Do we prefer more proxy clients over support for >5TH clients */
bool clientsvspeed;
/* Are we running without ckdb */ /* Are we running without ckdb */
bool standalone; bool standalone;

24
src/stratifier.c

@ -986,15 +986,27 @@ static void update_subscribe(ckpool_t *ckp)
sdata->proxy_base.enonce1constlen = strlen(sdata->proxy_base.enonce1) / 2; sdata->proxy_base.enonce1constlen = strlen(sdata->proxy_base.enonce1) / 2;
hex2bin(sdata->proxy_base.enonce1bin, sdata->proxy_base.enonce1, sdata->proxy_base.enonce1constlen); 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")); sdata->proxy_base.nonce2len = json_integer_value(json_object_get(val, "nonce2len"));
if (sdata->proxy_base.nonce2len > 7) if (ckp->clientsvspeed) {
sdata->proxy_base.enonce1varlen = 4; if (sdata->proxy_base.nonce2len > 5)
else if (sdata->proxy_base.nonce2len > 5) sdata->proxy_base.enonce1varlen = 4;
sdata->proxy_base.enonce1varlen = 2; else if (sdata->proxy_base.nonce2len > 3)
else sdata->proxy_base.enonce1varlen = 2;
sdata->proxy_base.enonce1varlen = 1; 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; sdata->proxy_base.enonce2varlen = sdata->proxy_base.nonce2len - sdata->proxy_base.enonce1varlen;
ck_wunlock(&sdata->workbase_lock); 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); json_decref(val);
drop_allclients(ckp); drop_allclients(ckp);
} }

Loading…
Cancel
Save