diff --git a/README b/README index 735bcbb0..e879c954 100644 --- a/README +++ b/README @@ -240,7 +240,10 @@ new network blocks and is 100 by default. It is intended to be a backup only for when the notifier is not set up and only polls if the "notify" field is not set on a btcd. -'noncelength" : This is optional allowing the extranonce1 length to be chosen +"nonce1length" : This is optional allowing the extranonce1 length to be chosen +from 2 to 8. Default 8 + +"nonce2length" : This is optional allowing the extranonce2 length to be chosen from 2 to 8. Default 8 "update_interval" : This is the frequency that stratum updates are sent out to diff --git a/ckpool.conf b/ckpool.conf index f9f767da..cf2dcc4e 100644 --- a/ckpool.conf +++ b/ckpool.conf @@ -16,7 +16,8 @@ "btcaddress" : "14BMjogz69qe8hk9thyzbmR5pg34mVKB1e", "btcsig" : "/mined by ck/", "blockpoll" : 100, -"noncelength" : 8, +"nonce1length" : 8, +"nonce2length" : 8, "update_interval" : 30, "serverurl" : "ckpool.org:3333", "mindiff" : 1, diff --git a/src/ckpool.c b/src/ckpool.c index ee528880..630a7721 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -1017,7 +1017,8 @@ static void parse_config(ckpool_t *ckp) ckp->btcsig[38] = '\0'; } json_get_int(&ckp->blockpoll, json_conf, "blockpoll"); - json_get_int(&ckp->noncelength, json_conf, "noncelength"); + json_get_int(&ckp->nonce1length, json_conf, "nonce1length"); + json_get_int(&ckp->nonce2length, json_conf, "nonce2length"); json_get_int(&ckp->update_interval, json_conf, "update_interval"); json_get_string(&ckp->serverurl, json_conf, "serverurl"); json_get_int64(&ckp->mindiff, json_conf, "mindiff"); @@ -1312,10 +1313,14 @@ int main(int argc, char **argv) ckp.btcaddress = ckp.donaddress; if (!ckp.blockpoll) ckp.blockpoll = 100; - if (!ckp.noncelength) - ckp.noncelength = 8; - else if (ckp.noncelength < 2 || ckp.noncelength > 8) - quit(0, "Invalid noncelength %d specified, must be 2~8", ckp.noncelength); + if (!ckp.nonce1length) + ckp.nonce1length = 8; + else if (ckp.nonce1length < 2 || ckp.nonce1length > 8) + quit(0, "Invalid nonce1length %d specified, must be 2~8", ckp.nonce1length); + if (!ckp.nonce2length) + ckp.nonce2length = 8; + else if (ckp.nonce2length < 2 || ckp.nonce2length > 8) + quit(0, "Invalid nonce2length %d specified, must be 2~8", ckp.nonce2length); if (!ckp.update_interval) ckp.update_interval = 30; if (!ckp.mindiff) diff --git a/src/ckpool.h b/src/ckpool.h index 5d5f48a1..3660d50b 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -148,7 +148,8 @@ struct ckpool_instance { char **btcdpass; bool *btcdnotify; int blockpoll; // How frequently in ms to poll bitcoind for block updates - int noncelength; // Extranonce1 length + int nonce1length; // Extranonce1 length + int nonce2length; // Extranonce2 length /* Difficulty settings */ int64_t mindiff; // Default 1 diff --git a/src/stratifier.c b/src/stratifier.c index c25f1e50..9efecb29 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -410,7 +410,8 @@ static void generate_coinbase(ckpool_t *ckp, workbase_t *wb) len = ser_number(wb->coinb1bin + ofs, now.tv_nsec); ofs += len; - wb->enonce1varlen = wb->enonce2varlen = ckp->noncelength; + wb->enonce1varlen = ckp->nonce1length; + wb->enonce2varlen = ckp->nonce2length; wb->coinb1bin[ofs++] = wb->enonce1varlen + wb->enonce2varlen; wb->coinb1len = ofs;