aboutsummaryrefslogtreecommitdiff
path: root/sha256_4way.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2011-02-03 00:46:55 -0500
committerJeff Garzik <jgarzik@redhat.com>2011-02-03 00:46:55 -0500
commit714c0fd7c90cdb11742f7f2c91a65357a7bf5d5a (patch)
treef96729029d4411e1f6a5b2aa484bbf7008ba09dd /sha256_4way.c
parentc68ffb30dd17b32f69665af18b72687875770972 (diff)
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.
Diffstat (limited to 'sha256_4way.c')
-rw-r--r--sha256_4way.c11
1 files changed, 6 insertions, 5 deletions
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;
+ }
}
}