|
|
@ -1506,7 +1506,7 @@ static bool parse_notify(struct pool *pool, json_t *val) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char *job_id, *prev_hash, *coinbase1, *coinbase2, *bbversion, *nbit, |
|
|
|
char *job_id, *prev_hash, *coinbase1, *coinbase2, *bbversion, *nbit, |
|
|
|
*ntime, *header; |
|
|
|
*ntime, *header; |
|
|
|
size_t cb1_len, cb2_len, alloc_len; |
|
|
|
size_t cb1_len, cb2_len, alloc_len, header_len; |
|
|
|
unsigned char *cb1, *cb2; |
|
|
|
unsigned char *cb1, *cb2; |
|
|
|
bool clean, ret = false; |
|
|
|
bool clean, ret = false; |
|
|
|
int merkles, i; |
|
|
|
int merkles, i; |
|
|
@ -1586,25 +1586,20 @@ static bool parse_notify(struct pool *pool, json_t *val) |
|
|
|
pool->nonce2 = 0; |
|
|
|
pool->nonce2 = 0; |
|
|
|
pool->merkle_offset = strlen(pool->swork.bbversion) + |
|
|
|
pool->merkle_offset = strlen(pool->swork.bbversion) + |
|
|
|
strlen(pool->swork.prev_hash); |
|
|
|
strlen(pool->swork.prev_hash); |
|
|
|
pool->swork.header_len = pool->merkle_offset + |
|
|
|
|
|
|
|
/* merkle_hash */ 32 + |
|
|
|
|
|
|
|
strlen(pool->swork.ntime) + |
|
|
|
|
|
|
|
strlen(pool->swork.nbit) + |
|
|
|
|
|
|
|
/* nonce */ 8 + |
|
|
|
|
|
|
|
/* workpadding */ 96; |
|
|
|
|
|
|
|
pool->merkle_offset /= 2; |
|
|
|
pool->merkle_offset /= 2; |
|
|
|
pool->swork.header_len = pool->swork.header_len * 2 + 1; |
|
|
|
header = (char *)alloca(257); |
|
|
|
align_len(&pool->swork.header_len); |
|
|
|
snprintf(header, 257, |
|
|
|
header = (char *)alloca(pool->swork.header_len); |
|
|
|
"%s%s%s%s%s%s", |
|
|
|
snprintf(header, pool->swork.header_len, |
|
|
|
|
|
|
|
"%s%s%s%s%s%s%s", |
|
|
|
|
|
|
|
pool->swork.bbversion, |
|
|
|
pool->swork.bbversion, |
|
|
|
pool->swork.prev_hash, |
|
|
|
pool->swork.prev_hash, |
|
|
|
blank_merkel, |
|
|
|
blank_merkel, |
|
|
|
pool->swork.ntime, |
|
|
|
pool->swork.ntime, |
|
|
|
pool->swork.nbit, |
|
|
|
pool->swork.nbit, |
|
|
|
"00000000", /* nonce */ |
|
|
|
"00000000" /* nonce */ |
|
|
|
workpadding); |
|
|
|
); |
|
|
|
|
|
|
|
header_len = strlen(header); |
|
|
|
|
|
|
|
memset(header + header_len, '0', 256 - header_len); |
|
|
|
|
|
|
|
header[256] = '\0'; |
|
|
|
if (unlikely(!hex2bin(pool->header_bin, header, 128))) { |
|
|
|
if (unlikely(!hex2bin(pool->header_bin, header, 128))) { |
|
|
|
applog(LOG_WARNING, "%s: Failed to convert header to header_bin, got %s", __func__, header); |
|
|
|
applog(LOG_WARNING, "%s: Failed to convert header to header_bin, got %s", __func__, header); |
|
|
|
pool_failed(pool); |
|
|
|
pool_failed(pool); |
|
|
|