diff options
author | Jeff Garzik <jeff@garzik.org> | 2011-03-17 22:02:28 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2011-03-17 22:02:28 -0400 |
commit | 2d49a9a5d767b85981ce73f1832e0eae06d0d52f (patch) | |
tree | 2281b3960552a6fcb14a62f60bbe09b0fafa5227 /sha256_via.c | |
parent | 4be41af2be1b2442161a98b9d7fbf2a61cc854f9 (diff) |
Introduce ability to interrupt hash scanners in the middle of scanning.
Diffstat (limited to 'sha256_via.c')
-rw-r--r-- | sha256_via.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sha256_via.c b/sha256_via.c index 186007e..158e757 100644 --- a/sha256_via.c +++ b/sha256_via.c @@ -17,7 +17,7 @@ static void via_sha256(void *hash, void *buf, unsigned len) :"memory"); } -bool scanhash_via(unsigned char *data_inout, +bool scanhash_via(int thr_id, unsigned char *data_inout, const unsigned char *target, uint32_t max_nonce, unsigned long *hashes_done) { @@ -31,6 +31,8 @@ bool scanhash_via(unsigned char *data_inout, unsigned long stat_ctr = 0; int i; + work_restart[thr_id].restart = 0; + /* bitcoin gives us big endian input, but via wants LE, * so we reverse the swapping bitcoin has already done (extra work) * in order to permit the hardware to swap everything @@ -70,7 +72,7 @@ bool scanhash_via(unsigned char *data_inout, return true; } - if (n >= max_nonce) { + if ((n >= max_nonce) || work_restart[thr_id].restart) { *hashes_done = stat_ctr; return false; } |