aboutsummaryrefslogtreecommitdiff
path: root/cpu-miner.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 /cpu-miner.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 'cpu-miner.c')
-rw-r--r--cpu-miner.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cpu-miner.c b/cpu-miner.c
index f9be60c..c3924a9 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -308,7 +308,7 @@ static void *miner_thread(void *thr_id_int)
switch (opt_algo) {
case ALGO_C:
rc = scanhash_c(work.midstate, work.data + 64,
- work.hash1, work.hash,
+ work.hash1, work.hash, work.target,
max_nonce, &hashes_done);
break;
@@ -317,6 +317,7 @@ static void *miner_thread(void *thr_id_int)
unsigned int rc4 =
ScanHash_4WaySSE2(work.midstate, work.data + 64,
work.hash1, work.hash,
+ work.target,
max_nonce, &hashes_done);
rc = (rc4 == -1) ? false : true;
}
@@ -325,19 +326,20 @@ static void *miner_thread(void *thr_id_int)
#ifdef WANT_VIA_PADLOCK
case ALGO_VIA:
- rc = scanhash_via(work.data, max_nonce, &hashes_done);
+ rc = scanhash_via(work.data, work.target,
+ max_nonce, &hashes_done);
break;
#endif
case ALGO_CRYPTOPP:
rc = scanhash_cryptopp(work.midstate, work.data + 64,
- work.hash1, work.hash,
+ work.hash1, work.hash, work.target,
max_nonce, &hashes_done);
break;
#ifdef WANT_CRYPTOPP_ASM32
case ALGO_CRYPTOPP_ASM32:
rc = scanhash_asm32(work.midstate, work.data + 64,
- work.hash1, work.hash,
+ work.hash1, work.hash, work.target,
max_nonce, &hashes_done);
break;
#endif