mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-05 19:44:21 +00:00
Correct target for stratum support with scrypt mining.
This commit is contained in:
parent
b9c7f3d169
commit
bb64799c84
14
cgminer.c
14
cgminer.c
@ -4960,23 +4960,31 @@ 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, double diff)
|
static void set_work_target(struct work *work, double diff)
|
||||||
{
|
{
|
||||||
unsigned char rtarget[32], target[32];
|
unsigned char target[32];
|
||||||
double d64;
|
|
||||||
uint64_t *data64, h64;
|
uint64_t *data64, h64;
|
||||||
|
double d64;
|
||||||
|
|
||||||
d64 = diffone;
|
d64 = diffone;
|
||||||
d64 /= diff;
|
d64 /= diff;
|
||||||
h64 = d64;
|
h64 = d64;
|
||||||
|
|
||||||
|
memset(target, 0, 32);
|
||||||
if (h64) {
|
if (h64) {
|
||||||
|
unsigned char rtarget[32];
|
||||||
|
|
||||||
memset(rtarget, 0, 32);
|
memset(rtarget, 0, 32);
|
||||||
|
if (opt_scrypt)
|
||||||
|
data64 = (uint64_t *)(rtarget + 2);
|
||||||
|
else
|
||||||
data64 = (uint64_t *)(rtarget + 4);
|
data64 = (uint64_t *)(rtarget + 4);
|
||||||
*data64 = htobe64(h64);
|
*data64 = htobe64(h64);
|
||||||
swab256(target, rtarget);
|
swab256(target, rtarget);
|
||||||
} else {
|
} else {
|
||||||
/* Support for the classic all FFs just-below-1 diff */
|
/* Support for the classic all FFs just-below-1 diff */
|
||||||
|
if (opt_scrypt)
|
||||||
|
memset(target, 0xff, 30);
|
||||||
|
else
|
||||||
memset(target, 0xff, 28);
|
memset(target, 0xff, 28);
|
||||||
memset(&target[28], 0, 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_debug) {
|
if (opt_debug) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user