Browse Source

Support monitoring and reporting much higher diffs for scrypt mining, truncating irrelevant zeroes from displayed hash.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
d8e18994d5
  1. 14
      cgminer.c
  2. 5
      scrypt.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) static uint32_t scrypt_diff(const struct work *work)
{ {
const uint32_t scrypt_diffone = 0x0000fffful; const uint64_t scrypt_diffone = 0x0000ffff00000000ul;
uint32_t d32 = work->outputhash, ret; uint64_t d64 = work->outputhash, ret;
if (unlikely(!d32)) if (unlikely(!d64))
d32 = 1; d64 = 1;
ret = scrypt_diffone / d32; ret = scrypt_diffone / d64;
if (ret > best_diff) { if (ret > best_diff) {
best_diff = ret; best_diff = ret;
suffix_string(best_diff, best_share, 0); 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); hash32 = (uint32_t *)(work->hash);
if (opt_scrypt) { if (opt_scrypt) {
uint32_t sharediff; uint32_t sharediff;
uint64_t outhash;
scrypt_outputhash(work); scrypt_outputhash(work);
sharediff = scrypt_diff(work); sharediff = scrypt_diff(work);
suffix_string(sharediff, diffdisp, 0); 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 { } else {
uint64_t sharediff = share_diff(work); uint64_t sharediff = share_diff(work);

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) void scrypt_outputhash(struct work *work)
{ {
uint32_t data[20], ohash[8]; uint32_t data[20], ohash[8], rhash[8];
char *scratchbuf; char *scratchbuf;
uint32_t *nonce = (uint32_t *)(work->data + 76); uint32_t *nonce = (uint32_t *)(work->data + 76);
@ -412,7 +412,8 @@ void scrypt_outputhash(struct work *work)
data[19] = htobe32(*nonce); data[19] = htobe32(*nonce);
scratchbuf = alloca(131584); scratchbuf = alloca(131584);
scrypt_1024_1_1_256_sp(data, scratchbuf, ohash); 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 */ /* Used externally as confirmation of correct OCL code */

Loading…
Cancel
Save