mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Provide a way for drivers to submit work that it has internally rolled the ntime value by returning the amount it has ntime rolled to be added.
This commit is contained in:
parent
b5c49aefd7
commit
4c79252dc8
18
cgminer.c
18
cgminer.c
@ -6084,6 +6084,24 @@ bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Allows drivers to submit work items where the driver has changed the ntime
|
||||||
|
* value by noffset. Must be only used with a work protocol that does not ntime
|
||||||
|
* roll itself intrinsically to generate work (eg stratum). */
|
||||||
|
bool submit_noffset_nonce(struct thr_info *thr, struct work *work, uint32_t nonce,
|
||||||
|
int noffset)
|
||||||
|
{
|
||||||
|
unsigned char bin[4];
|
||||||
|
uint32_t h32, *be32 = (uint32_t *)bin;
|
||||||
|
|
||||||
|
hex2bin(bin, work->ntime, 4);
|
||||||
|
h32 = be32toh(*be32) + noffset;
|
||||||
|
*be32 = htobe32(h32);
|
||||||
|
free(work->ntime);
|
||||||
|
work->ntime = bin2hex(bin, 4);
|
||||||
|
|
||||||
|
return submit_nonce(thr, work, nonce);
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool abandon_work(struct work *work, struct timeval *wdiff, uint64_t hashes)
|
static inline bool abandon_work(struct work *work, struct timeval *wdiff, uint64_t hashes)
|
||||||
{
|
{
|
||||||
if (wdiff->tv_sec > opt_scantime ||
|
if (wdiff->tv_sec > opt_scantime ||
|
||||||
|
2
miner.h
2
miner.h
@ -1388,6 +1388,8 @@ extern void inc_hw_errors(struct thr_info *thr);
|
|||||||
extern bool test_nonce(struct work *work, uint32_t nonce);
|
extern bool test_nonce(struct work *work, uint32_t nonce);
|
||||||
extern void submit_tested_work(struct thr_info *thr, struct work *work);
|
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_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,
|
||||||
|
int noffset);
|
||||||
extern struct work *get_queued(struct cgpu_info *cgpu);
|
extern struct work *get_queued(struct cgpu_info *cgpu);
|
||||||
extern struct work *__find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);
|
extern struct work *__find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);
|
||||||
extern struct work *find_queued_work_bymidstate(struct cgpu_info *cgpu, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);
|
extern struct work *find_queued_work_bymidstate(struct cgpu_info *cgpu, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);
|
||||||
|
Loading…
Reference in New Issue
Block a user