|
|
@ -5068,7 +5068,7 @@ static struct work *clone_work(struct work *work) |
|
|
|
|
|
|
|
|
|
|
|
static void gen_hash(unsigned char *data, unsigned char *hash, int len) |
|
|
|
static void gen_hash(unsigned char *data, unsigned char *hash, int len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
unsigned char hash1[36]; |
|
|
|
unsigned char hash1[32]; |
|
|
|
|
|
|
|
|
|
|
|
sha2(data, len, hash1, false); |
|
|
|
sha2(data, len, hash1, false); |
|
|
|
sha2(hash1, 32, hash, false); |
|
|
|
sha2(hash1, 32, hash, false); |
|
|
@ -5080,7 +5080,7 @@ static void gen_hash(unsigned char *data, unsigned char *hash, int len) |
|
|
|
* cover a huge range of difficulty targets, though not all 256 bits' worth */ |
|
|
|
* cover a huge range of difficulty targets, though not all 256 bits' worth */ |
|
|
|
static void set_work_target(struct work *work, int diff) |
|
|
|
static void set_work_target(struct work *work, int diff) |
|
|
|
{ |
|
|
|
{ |
|
|
|
unsigned char rtarget[36], target[36]; |
|
|
|
unsigned char rtarget[32], target[32]; |
|
|
|
uint64_t *data64, h64; |
|
|
|
uint64_t *data64, h64; |
|
|
|
|
|
|
|
|
|
|
|
h64 = diffone; |
|
|
|
h64 = diffone; |
|
|
@ -5103,9 +5103,9 @@ static void set_work_target(struct work *work, int diff) |
|
|
|
* other means to detect when the pool has died in stratum_thread */ |
|
|
|
* other means to detect when the pool has died in stratum_thread */ |
|
|
|
static void gen_stratum_work(struct pool *pool, struct work *work) |
|
|
|
static void gen_stratum_work(struct pool *pool, struct work *work) |
|
|
|
{ |
|
|
|
{ |
|
|
|
unsigned char *coinbase, merkle_root[36], merkle_sha[68], *merkle_hash; |
|
|
|
unsigned char *coinbase, merkle_root[32], merkle_sha[64], *merkle_hash; |
|
|
|
int len, cb1_len, n1_len, cb2_len, i; |
|
|
|
int len, cb1_len, n1_len, cb2_len, i; |
|
|
|
char header[260], *nonce2; |
|
|
|
char header[256], *nonce2; |
|
|
|
uint32_t *data32, *swap32; |
|
|
|
uint32_t *data32, *swap32; |
|
|
|
|
|
|
|
|
|
|
|
memset(work->job_id, 0, 64); |
|
|
|
memset(work->job_id, 0, 64); |
|
|
@ -5131,7 +5131,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work) |
|
|
|
gen_hash(coinbase, merkle_root, len); |
|
|
|
gen_hash(coinbase, merkle_root, len); |
|
|
|
memcpy(merkle_sha, merkle_root, 32); |
|
|
|
memcpy(merkle_sha, merkle_root, 32); |
|
|
|
for (i = 0; i < pool->swork.merkles; i++) { |
|
|
|
for (i = 0; i < pool->swork.merkles; i++) { |
|
|
|
unsigned char merkle_bin[36]; |
|
|
|
unsigned char merkle_bin[32]; |
|
|
|
|
|
|
|
|
|
|
|
hex2bin(merkle_bin, pool->swork.merkle[i], 32); |
|
|
|
hex2bin(merkle_bin, pool->swork.merkle[i], 32); |
|
|
|
memcpy(merkle_sha + 32, merkle_bin, 32); |
|
|
|
memcpy(merkle_sha + 32, merkle_bin, 32); |
|
|
|