1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-10 23:08:07 +00:00

Allow arbitrary diffs to be tested against nonces via a test_nonce_diff function.

This commit is contained in:
Con Kolivas 2013-10-31 17:15:42 +11:00
parent 99b24c48fd
commit ac5b12e1a0
2 changed files with 13 additions and 0 deletions

View File

@ -6104,6 +6104,18 @@ bool test_nonce(struct work *work, uint32_t nonce)
return (be32toh(hash2_32[7]) <= diff1targ);
}
bool test_nonce_diff(struct work *work, uint32_t nonce, double diff)
{
uint32_t hash2_be[8];
uint64_t *hashbe64 = (uint64_t *)hash2_be, hash64, diff64;
diff64 = (double)0x00000000ffff0000ULL / diff;
rebuild_hash2(work, nonce);
swap256(hash2_be, work->hash2);
hash64 = be64toh(*hashbe64);
return hash64 <= diff64;
}
static void update_work_stats(struct thr_info *thr, struct work *work)
{
work->share_diff = share_diff(work);

View File

@ -1490,6 +1490,7 @@ struct modminer_fpga_state {
extern void get_datestamp(char *, size_t, struct timeval *);
extern void inc_hw_errors(struct thr_info *thr);
extern bool test_nonce(struct work *work, uint32_t nonce);
extern bool test_nonce_diff(struct work *work, uint32_t nonce, double diff);
extern void submit_tested_work(struct thr_info *thr, struct work *work);
extern bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
extern bool submit_noffset_nonce(struct thr_info *thr, struct work *work, uint32_t nonce,