aboutsummaryrefslogtreecommitdiff
path: root/sha256_via.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_via.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_via.c')
-rw-r--r--sha256_via.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sha256_via.c b/sha256_via.c
index 011d854..a15c664 100644
--- a/sha256_via.c
+++ b/sha256_via.c
@@ -18,6 +18,7 @@ static void via_sha256(void *hash, void *buf, unsigned len)
}
bool scanhash_via(unsigned char *data_inout,
+ const unsigned char *target,
uint32_t max_nonce, unsigned long *hashes_done)
{
unsigned char data[128] __attribute__((aligned(128)));
@@ -56,9 +57,7 @@ bool scanhash_via(unsigned char *data_inout,
stat_ctr++;
- if (hash32[7] == 0) {
- print_pow(tmp_hash);
-
+ if ((hash32[7] == 0) && fulltest(tmp_hash, target)) {
/* swap nonce'd data back into original storage area;
* TODO: only swap back the nonce, rather than all data
*/