aboutsummaryrefslogtreecommitdiff
path: root/sha256_generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha256_generic.c')
-rw-r--r--sha256_generic.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sha256_generic.c b/sha256_generic.c
index 596a6db..b30b326 100644
--- a/sha256_generic.c
+++ b/sha256_generic.c
@@ -237,7 +237,7 @@ const uint32_t sha256_init_state[8] = {
};
/* suspiciously similar to ScanHash* from bitcoin */
-bool scanhash_c(const unsigned char *midstate, unsigned char *data,
+bool scanhash_c(int thr_id, 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)
@@ -247,6 +247,8 @@ bool scanhash_c(const unsigned char *midstate, unsigned char *data,
uint32_t n = 0;
unsigned long stat_ctr = 0;
+ work_restart[thr_id].restart = 0;
+
while (1) {
n++;
*nonce = n;
@@ -261,7 +263,7 @@ bool scanhash_c(const unsigned char *midstate, unsigned char *data,
return true;
}
- if (n >= max_nonce) {
+ if ((n >= max_nonce) || work_restart[thr_id].restart) {
*hashes_done = stat_ctr;
return false;
}