|
|
@ -147,7 +147,6 @@ static struct { |
|
|
|
|
|
|
|
|
|
|
|
int nonce2len; |
|
|
|
int nonce2len; |
|
|
|
int enonce2constlen; |
|
|
|
int enonce2constlen; |
|
|
|
uint32_t subnonce2; |
|
|
|
|
|
|
|
int enonce2varlen; |
|
|
|
int enonce2varlen; |
|
|
|
} proxy_base; |
|
|
|
} proxy_base; |
|
|
|
|
|
|
|
|
|
|
@ -182,7 +181,7 @@ struct stratum_instance { |
|
|
|
UT_hash_handle hh; |
|
|
|
UT_hash_handle hh; |
|
|
|
int id; |
|
|
|
int id; |
|
|
|
|
|
|
|
|
|
|
|
char enonce1[20]; |
|
|
|
char enonce1[32]; |
|
|
|
uint64_t enonce1_64; |
|
|
|
uint64_t enonce1_64; |
|
|
|
|
|
|
|
|
|
|
|
int diff; /* Current diff */ |
|
|
|
int diff; /* Current diff */ |
|
|
@ -525,7 +524,6 @@ static void update_notify(ckpool_t *ckp) |
|
|
|
clean = json_is_true(json_object_get(val, "clean")); |
|
|
|
clean = json_is_true(json_object_get(val, "clean")); |
|
|
|
json_decref(val); |
|
|
|
json_decref(val); |
|
|
|
wb->gentime = time(NULL); |
|
|
|
wb->gentime = time(NULL); |
|
|
|
wb->enonce1varlen = 0; |
|
|
|
|
|
|
|
snprintf(header, 225, "%s%s%s%s%s%s%s", |
|
|
|
snprintf(header, 225, "%s%s%s%s%s%s%s", |
|
|
|
wb->bbversion, wb->prevhash, |
|
|
|
wb->bbversion, wb->prevhash, |
|
|
|
"0000000000000000000000000000000000000000000000000000000000000000", |
|
|
|
"0000000000000000000000000000000000000000000000000000000000000000", |
|
|
@ -822,6 +820,31 @@ static void *blockupdate(void *arg) |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint64_t new_enonce1(char *enonce1) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
workbase_t *wb; |
|
|
|
|
|
|
|
uint64_t ret; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ck_wlock(&workbase_lock); |
|
|
|
|
|
|
|
wb = current_workbase; |
|
|
|
|
|
|
|
if (wb->enonce1varlen == 8) { |
|
|
|
|
|
|
|
enonce1_64++; |
|
|
|
|
|
|
|
} else if (wb->enonce1varlen == 2) { |
|
|
|
|
|
|
|
uint16_t *enonce1_16 = (uint16_t *)&enonce1_64; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
++(*enonce1_16); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
uint32_t *enonce1_32 = (uint32_t *)&enonce1_64; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
++(*enonce1_32); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
sprintf(enonce1, "%s%0*lx", wb->enonce1const, wb->enonce1varlen, enonce1_64); |
|
|
|
|
|
|
|
ret = enonce1_64; |
|
|
|
|
|
|
|
ck_wunlock(&workbase_lock); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ret; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Extranonce1 must be set here */ |
|
|
|
/* Extranonce1 must be set here */ |
|
|
|
static json_t *parse_subscribe(int client_id, json_t *params_val) |
|
|
|
static json_t *parse_subscribe(int client_id, json_t *params_val) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -864,13 +887,8 @@ static json_t *parse_subscribe(int client_id, json_t *params_val) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!old_match) { |
|
|
|
if (!old_match) { |
|
|
|
/* Create a new extranonce1 based on non-endian swapped
|
|
|
|
/* Create a new extranonce1 based on a uint64_t pointer */ |
|
|
|
* uint64_t pointer */ |
|
|
|
client->enonce1_64 = new_enonce1(client->enonce1); |
|
|
|
ck_wlock(&instance_lock); |
|
|
|
|
|
|
|
client->enonce1_64 = enonce1_64++; |
|
|
|
|
|
|
|
ck_wunlock(&instance_lock); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__bin2hex(client->enonce1, &client->enonce1_64, 8); |
|
|
|
|
|
|
|
LOGINFO("Set new subscription %d to new enonce1 %s", client->id, |
|
|
|
LOGINFO("Set new subscription %d to new enonce1 %s", client->id, |
|
|
|
client->enonce1); |
|
|
|
client->enonce1); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|