From 714c0fd7c90cdb11742f7f2c91a65357a7bf5d5a Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Thu, 3 Feb 2011 00:46:55 -0500 Subject: Continue scanhash, even if high 32 bits are zero. Previously, we would stop the scan if the high 32 bits of the hash were zero, as a quick shortcut for testing the full hash. If this quick test succeeded, we would pass the work to the server for full validation. Change this logic to perform full validation inside minerd, so that work may be resumed more quickly if hash > target. --- sha256_4way.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sha256_4way.c') diff --git a/sha256_4way.c b/sha256_4way.c index 556a07a..fe9642b 100644 --- a/sha256_4way.c +++ b/sha256_4way.c @@ -100,6 +100,7 @@ static const unsigned int pSHA256InitState[8] = unsigned int ScanHash_4WaySSE2(const unsigned char *pmidstate, unsigned char *pdata, unsigned char *phash1, unsigned char *phash, + const unsigned char *ptarget, uint32_t max_nonce, unsigned long *nHashesDone) { unsigned int *nNonce_p = (unsigned int*)(pdata + 12); @@ -124,11 +125,11 @@ unsigned int ScanHash_4WaySSE2(const unsigned char *pmidstate, unsigned char *pd for (i = 0; i < 32/4; i++) ((unsigned int*)phash)[i] = thash[i][j]; - print_pow(phash); - - *nHashesDone = nonce; - *nNonce_p = nonce + j; - return nonce + j; + if (fulltest(phash, ptarget)) { + *nHashesDone = nonce; + *nNonce_p = nonce + j; + return nonce + j; + } } } -- cgit v1.2.3-18-g5258