mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 01:44:23 +00:00
Support monitoring and reporting much higher diffs for scrypt mining, truncating irrelevant zeroes from displayed hash.
This commit is contained in:
parent
33c9faae11
commit
d8e18994d5
14
cgminer.c
14
cgminer.c
@ -2264,12 +2264,12 @@ static uint64_t share_diff(const struct work *work)
|
||||
|
||||
static uint32_t scrypt_diff(const struct work *work)
|
||||
{
|
||||
const uint32_t scrypt_diffone = 0x0000fffful;
|
||||
uint32_t d32 = work->outputhash, ret;
|
||||
const uint64_t scrypt_diffone = 0x0000ffff00000000ul;
|
||||
uint64_t d64 = work->outputhash, ret;
|
||||
|
||||
if (unlikely(!d32))
|
||||
d32 = 1;
|
||||
ret = scrypt_diffone / d32;
|
||||
if (unlikely(!d64))
|
||||
d64 = 1;
|
||||
ret = scrypt_diffone / d64;
|
||||
if (ret > best_diff) {
|
||||
best_diff = ret;
|
||||
suffix_string(best_diff, best_share, 0);
|
||||
@ -2367,12 +2367,14 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
|
||||
hash32 = (uint32_t *)(work->hash);
|
||||
if (opt_scrypt) {
|
||||
uint32_t sharediff;
|
||||
uint64_t outhash;
|
||||
|
||||
scrypt_outputhash(work);
|
||||
sharediff = scrypt_diff(work);
|
||||
suffix_string(sharediff, diffdisp, 0);
|
||||
|
||||
sprintf(hashshow, "%08lx Diff %s/%d", (unsigned long)work->outputhash, diffdisp, intdiff);
|
||||
outhash = work->outputhash >> 16;
|
||||
sprintf(hashshow, "%08lx Diff %s/%d", (unsigned long)outhash, diffdisp, intdiff);
|
||||
} else {
|
||||
uint64_t sharediff = share_diff(work);
|
||||
|
||||
|
5
scrypt.c
5
scrypt.c
@ -404,7 +404,7 @@ static void scrypt_1024_1_1_256_sp(const uint32_t* input, char* scratchpad, uint
|
||||
|
||||
void scrypt_outputhash(struct work *work)
|
||||
{
|
||||
uint32_t data[20], ohash[8];
|
||||
uint32_t data[20], ohash[8], rhash[8];
|
||||
char *scratchbuf;
|
||||
uint32_t *nonce = (uint32_t *)(work->data + 76);
|
||||
|
||||
@ -412,7 +412,8 @@ void scrypt_outputhash(struct work *work)
|
||||
data[19] = htobe32(*nonce);
|
||||
scratchbuf = alloca(131584);
|
||||
scrypt_1024_1_1_256_sp(data, scratchbuf, ohash);
|
||||
work->outputhash = be32toh(ohash[7]);
|
||||
swap256(rhash, ohash);
|
||||
work->outputhash = be64toh(*((uint64_t *)rhash));
|
||||
}
|
||||
|
||||
/* Used externally as confirmation of correct OCL code */
|
||||
|
Loading…
x
Reference in New Issue
Block a user