mirror of
https://github.com/GOSTSec/sgminer
synced 2025-03-09 20:21:01 +00:00
Cache the hex2bin of pool nonce1 in stratum, avoiding hex2bin on each work generation.
This commit is contained in:
parent
fef649dfef
commit
b423fe9de8
@ -5612,7 +5612,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
|
||||
if (unlikely(!coinbase))
|
||||
quit(1, "Failed to calloc coinbase in gen_stratum_work");
|
||||
memcpy(coinbase, pool->swork.cb1, pool->swork.cb1_len);
|
||||
hex2bin(coinbase + pool->swork.cb1_len, pool->nonce1, pool->n1_len);
|
||||
memcpy(coinbase + pool->swork.cb1_len, pool->nonce1bin, pool->n1_len);
|
||||
hex2bin(coinbase + pool->swork.cb1_len + pool->n1_len, work->nonce2, pool->n2size);
|
||||
memcpy(coinbase + pool->swork.cb1_len + pool->n1_len + pool->n2size, pool->swork.cb2, pool->swork.cb2_len);
|
||||
|
||||
|
1
miner.h
1
miner.h
@ -1154,6 +1154,7 @@ struct pool {
|
||||
size_t sockbuf_size;
|
||||
char *sockaddr_url; /* stripped url used for sockaddr */
|
||||
char *nonce1;
|
||||
unsigned char *nonce1bin;
|
||||
size_t n1_len;
|
||||
uint32_t nonce2;
|
||||
int n2size;
|
||||
|
5
util.c
5
util.c
@ -1718,6 +1718,11 @@ resend:
|
||||
pool->sessionid = sessionid;
|
||||
pool->nonce1 = nonce1;
|
||||
pool->n1_len = strlen(nonce1) / 2;
|
||||
free(pool->nonce1bin);
|
||||
pool->nonce1bin = calloc(pool->n1_len, 1);
|
||||
if (unlikely(!pool->nonce1bin))
|
||||
quit(1, "Failed to calloc pool->nonce1bin in initiate_stratum");
|
||||
hex2bin(pool->nonce1bin, pool->nonce1, pool->n1_len);
|
||||
pool->n2size = n2size;
|
||||
cg_wunlock(&pool->data_lock);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user