Browse Source

Allow nonce1 and nonce2 lengths to be specified separately

master
Con Kolivas 10 years ago
parent
commit
0709058b25
  1. 5
      README
  2. 3
      ckpool.conf
  3. 15
      src/ckpool.c
  4. 3
      src/ckpool.h
  5. 3
      src/stratifier.c

5
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 for when the notifier is not set up and only polls if the "notify" field is
not set on a btcd. 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 from 2 to 8. Default 8
"update_interval" : This is the frequency that stratum updates are sent out to "update_interval" : This is the frequency that stratum updates are sent out to

3
ckpool.conf

@ -16,7 +16,8 @@
"btcaddress" : "14BMjogz69qe8hk9thyzbmR5pg34mVKB1e", "btcaddress" : "14BMjogz69qe8hk9thyzbmR5pg34mVKB1e",
"btcsig" : "/mined by ck/", "btcsig" : "/mined by ck/",
"blockpoll" : 100, "blockpoll" : 100,
"noncelength" : 8, "nonce1length" : 8,
"nonce2length" : 8,
"update_interval" : 30, "update_interval" : 30,
"serverurl" : "ckpool.org:3333", "serverurl" : "ckpool.org:3333",
"mindiff" : 1, "mindiff" : 1,

15
src/ckpool.c

@ -1017,7 +1017,8 @@ static void parse_config(ckpool_t *ckp)
ckp->btcsig[38] = '\0'; ckp->btcsig[38] = '\0';
} }
json_get_int(&ckp->blockpoll, json_conf, "blockpoll"); 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_int(&ckp->update_interval, json_conf, "update_interval");
json_get_string(&ckp->serverurl, json_conf, "serverurl"); json_get_string(&ckp->serverurl, json_conf, "serverurl");
json_get_int64(&ckp->mindiff, json_conf, "mindiff"); json_get_int64(&ckp->mindiff, json_conf, "mindiff");
@ -1312,10 +1313,14 @@ int main(int argc, char **argv)
ckp.btcaddress = ckp.donaddress; ckp.btcaddress = ckp.donaddress;
if (!ckp.blockpoll) if (!ckp.blockpoll)
ckp.blockpoll = 100; ckp.blockpoll = 100;
if (!ckp.noncelength) if (!ckp.nonce1length)
ckp.noncelength = 8; ckp.nonce1length = 8;
else if (ckp.noncelength < 2 || ckp.noncelength > 8) else if (ckp.nonce1length < 2 || ckp.nonce1length > 8)
quit(0, "Invalid noncelength %d specified, must be 2~8", ckp.noncelength); 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) if (!ckp.update_interval)
ckp.update_interval = 30; ckp.update_interval = 30;
if (!ckp.mindiff) if (!ckp.mindiff)

3
src/ckpool.h

@ -148,7 +148,8 @@ struct ckpool_instance {
char **btcdpass; char **btcdpass;
bool *btcdnotify; bool *btcdnotify;
int blockpoll; // How frequently in ms to poll bitcoind for block updates 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 */ /* Difficulty settings */
int64_t mindiff; // Default 1 int64_t mindiff; // Default 1

3
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); len = ser_number(wb->coinb1bin + ofs, now.tv_nsec);
ofs += len; ofs += len;
wb->enonce1varlen = wb->enonce2varlen = ckp->noncelength; wb->enonce1varlen = ckp->nonce1length;
wb->enonce2varlen = ckp->nonce2length;
wb->coinb1bin[ofs++] = wb->enonce1varlen + wb->enonce2varlen; wb->coinb1bin[ofs++] = wb->enonce1varlen + wb->enonce2varlen;
wb->coinb1len = ofs; wb->coinb1len = ofs;

Loading…
Cancel
Save