|
|
@ -2138,13 +2138,9 @@ void clear_logwin(void) |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/* regenerate the full work->hash value and also return true if it's a block */ |
|
|
|
/* Returns true if the regenerated work->hash solves a block */ |
|
|
|
bool regeneratehash(const struct work *work) |
|
|
|
static bool solves_block(const struct work *work) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint32_t *data32 = (uint32_t *)(work->data); |
|
|
|
|
|
|
|
unsigned char swap[80]; |
|
|
|
|
|
|
|
uint32_t *swap32 = (uint32_t *)swap; |
|
|
|
|
|
|
|
unsigned char hash1[32]; |
|
|
|
|
|
|
|
uint32_t *hash32 = (uint32_t *)(work->hash); |
|
|
|
uint32_t *hash32 = (uint32_t *)(work->hash); |
|
|
|
uint32_t difficulty = 0; |
|
|
|
uint32_t difficulty = 0; |
|
|
|
uint32_t diffbytes = 0; |
|
|
|
uint32_t diffbytes = 0; |
|
|
@ -2153,10 +2149,6 @@ bool regeneratehash(const struct work *work) |
|
|
|
int diffshift = 0; |
|
|
|
int diffshift = 0; |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
flip80(swap32, data32); |
|
|
|
|
|
|
|
sha2(swap, 80, hash1); |
|
|
|
|
|
|
|
sha2(hash1, 32, (unsigned char *)(work->hash)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
difficulty = swab32(*((uint32_t *)(work->data + 72))); |
|
|
|
difficulty = swab32(*((uint32_t *)(work->data + 72))); |
|
|
|
|
|
|
|
|
|
|
|
diffbytes = ((difficulty >> 24) & 0xff) - 3; |
|
|
|
diffbytes = ((difficulty >> 24) & 0xff) - 3; |
|
|
@ -3072,16 +3064,26 @@ static bool stale_work(struct work *work, bool share) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void regen_hash(struct work *work) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
uint32_t *data32 = (uint32_t *)(work->data); |
|
|
|
|
|
|
|
unsigned char swap[80]; |
|
|
|
|
|
|
|
uint32_t *swap32 = (uint32_t *)swap; |
|
|
|
|
|
|
|
unsigned char hash1[32]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flip80(swap32, data32); |
|
|
|
|
|
|
|
sha2(swap, 80, hash1); |
|
|
|
|
|
|
|
sha2(hash1, 32, (unsigned char *)(work->hash)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void check_solve(struct work *work) |
|
|
|
static void check_solve(struct work *work) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (opt_scrypt) |
|
|
|
if (opt_scrypt) |
|
|
|
scrypt_outputhash(work); |
|
|
|
scrypt_outputhash(work); |
|
|
|
else { |
|
|
|
else |
|
|
|
#ifndef MIPSEB |
|
|
|
regen_hash(work); |
|
|
|
/* This segfaults on openwrt */ |
|
|
|
|
|
|
|
work->block = regeneratehash(work); |
|
|
|
work->block = solves_block(work); |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (unlikely(work->block)) { |
|
|
|
if (unlikely(work->block)) { |
|
|
|
work->pool->solved++; |
|
|
|
work->pool->solved++; |
|
|
|
found_blocks++; |
|
|
|
found_blocks++; |
|
|
|