mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 15:27:53 +00:00
Use correct length for offsetting extra nonce and remaining data.
This commit is contained in:
parent
a4e78be1ed
commit
14c436ee1f
@ -1361,8 +1361,8 @@ static void calc_midstate(struct work *work)
|
||||
* entered under gbt_lock */
|
||||
static void __build_gbt_coinbase(struct pool *pool)
|
||||
{
|
||||
int cbt_len, cal_len, orig_len;
|
||||
unsigned char *coinbase;
|
||||
int cbt_len, cal_len;
|
||||
uint8_t *extra_len;
|
||||
|
||||
cbt_len = strlen(pool->coinbasetxn) / 2;
|
||||
@ -1374,10 +1374,11 @@ static void __build_gbt_coinbase(struct pool *pool)
|
||||
coinbase = calloc(cal_len, 1);
|
||||
hex2bin(coinbase, pool->coinbasetxn, 42);
|
||||
extra_len = (uint8_t *)(coinbase + 41);
|
||||
hex2bin(coinbase + 42, pool->coinbasetxn + 84, *extra_len);
|
||||
memcpy(coinbase + 42 + *extra_len, &pool->nonce2, 4);
|
||||
orig_len = *extra_len;
|
||||
hex2bin(coinbase + 42, pool->coinbasetxn + 84, orig_len);
|
||||
memcpy(coinbase + 42 + orig_len, &pool->nonce2, 4);
|
||||
*extra_len += 4;
|
||||
hex2bin(coinbase + 42 + *extra_len, pool->coinbasetxn + 84 + (*extra_len * 2), cbt_len - *extra_len - 42);
|
||||
hex2bin(coinbase + 42 + *extra_len, pool->coinbasetxn + 84 + (orig_len * 2), cbt_len - orig_len - 42);
|
||||
pool->nonce2++;
|
||||
free(pool->gbt_coinbase);
|
||||
pool->gbt_coinbase = coinbase;
|
||||
|
Loading…
Reference in New Issue
Block a user