kanoi 10 years ago
parent
commit
2255a8edbe
  1. 2
      AUTHORS
  2. 5
      README
  3. 11
      src/stratifier.c

2
AUTHORS

@ -1,6 +1,6 @@
Con Kolivas <kernel@kolivas.org> Con Kolivas <kernel@kolivas.org>
Core project lead, maintainer, author of ckpool and libckpool. Core project lead, maintainer, author of ckpool and libckpool.
15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ 14BMjogz69qe8hk9thyzbmR5pg34mVKB1e
Andrew Smith <kan0i {at} kano-kun [dot] net> Andrew Smith <kan0i {at} kano-kun [dot] net>
Maintainer and author of ckdb. Maintainer and author of ckdb.

5
README

@ -4,6 +4,11 @@ Ultra low overhead massively scaleable multi-process, multi-threaded modular
bitcoin mining pool, proxy, passthrough, library and database interface in c bitcoin mining pool, proxy, passthrough, library and database interface in c
for Linux. for Linux.
CKPOOL is code provided free of charge under the GPLv3 license but its development
is mostly paid for by commissioned funding, and the pool by default contributes
0.5% of solved blocks in pool mode to the development team. Please consider leaving
this contribution in the code if you are running it on a pool or contributing to the
authors listed in AUTHORS if you use this code to aid funding further development.
--- ---
LICENSE: LICENSE:

11
src/stratifier.c

@ -1731,12 +1731,12 @@ static json_t *parse_submit(stratum_instance_t *client, json_t *json_msg,
{ {
bool share = false, result = false, invalid = true, submit = false; bool share = false, result = false, invalid = true, submit = false;
user_instance_t *user_instance = client->user_instance; user_instance_t *user_instance = client->user_instance;
const char *user, *job_id, *nonce2, *ntime, *nonce;
double diff = client->diff, wdiff = 0, sdiff = -1; double diff = client->diff, wdiff = 0, sdiff = -1;
char hexhash[68] = {}, sharehash[32], cdfield[64]; char hexhash[68] = {}, sharehash[32], cdfield[64];
const char *user, *job_id, *ntime, *nonce;
char *fname = NULL, *s, *nonce2;
enum share_err err = SE_NONE; enum share_err err = SE_NONE;
ckpool_t *ckp = client->ckp; ckpool_t *ckp = client->ckp;
char *fname = NULL, *s;
char idstring[20]; char idstring[20];
uint32_t ntime32; uint32_t ntime32;
workbase_t *wb; workbase_t *wb;
@ -1772,7 +1772,7 @@ static json_t *parse_submit(stratum_instance_t *client, json_t *json_msg,
*err_val = JSON_ERR(err); *err_val = JSON_ERR(err);
goto out; goto out;
} }
nonce2 = json_string_value(json_array_get(params_val, 2)); nonce2 = (char *)json_string_value(json_array_get(params_val, 2));
if (unlikely(!nonce2 || !strlen(nonce2))) { if (unlikely(!nonce2 || !strlen(nonce2))) {
err = SE_NO_NONCE2; err = SE_NO_NONCE2;
*err_val = JSON_ERR(err); *err_val = JSON_ERR(err);
@ -1812,6 +1812,9 @@ static json_t *parse_submit(stratum_instance_t *client, json_t *json_msg,
wdiff = wb->diff; wdiff = wb->diff;
strcpy(idstring, wb->idstring); strcpy(idstring, wb->idstring);
ASPRINTF(&fname, "%s.sharelog", wb->logdir); ASPRINTF(&fname, "%s.sharelog", wb->logdir);
/* Fix broken clients sending too many chars */
if ((int)strlen(nonce2) > wb->enonce2varlen * 2)
nonce2[wb->enonce2varlen * 2] = '\0';
sdiff = submission_diff(client, wb, nonce2, ntime32, nonce, hash); sdiff = submission_diff(client, wb, nonce2, ntime32, nonce, hash);
bswap_256(sharehash, hash); bswap_256(sharehash, hash);
__bin2hex(hexhash, sharehash, 32); __bin2hex(hexhash, sharehash, 32);
@ -1821,7 +1824,7 @@ static json_t *parse_submit(stratum_instance_t *client, json_t *json_msg,
json_set_string(json_msg, "reject-reason", SHARE_ERR(err)); json_set_string(json_msg, "reject-reason", SHARE_ERR(err));
goto out_unlock; goto out_unlock;
} }
if ((int)strlen(nonce2) != wb->enonce2varlen * 2) { if ((int)strlen(nonce2) < wb->enonce2varlen * 2) {
err = SE_INVALID_NONCE2; err = SE_INVALID_NONCE2;
*err_val = JSON_ERR(err); *err_val = JSON_ERR(err);
goto out_unlock; goto out_unlock;

Loading…
Cancel
Save