aboutsummaryrefslogtreecommitdiff
path: root/sha256_generic.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_generic.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_generic.c')
-rw-r--r--sha256_generic.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sha256_generic.c b/sha256_generic.c
index 91fbbcf..cc23fc1 100644
--- a/sha256_generic.c
+++ b/sha256_generic.c
@@ -239,6 +239,7 @@ const uint32_t sha256_init_state[8] = {
/* suspiciously similar to ScanHash* from bitcoin */
bool scanhash_c(const unsigned char *midstate, unsigned char *data,
unsigned char *hash1, unsigned char *hash,
+ const unsigned char *target,
uint32_t max_nonce, unsigned long *hashes_done)
{
uint32_t *hash32 = (uint32_t *) hash;
@@ -255,9 +256,7 @@ bool scanhash_c(const unsigned char *midstate, unsigned char *data,
stat_ctr++;
- if (hash32[7] == 0) {
- print_pow(hash);
-
+ if ((hash32[7] == 0) && fulltest(hash, target)) {
*hashes_done = stat_ctr;
return true;
}