Browse Source

Make set_work_target a function to set a specified char as target for use elsewhere.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
2fb6637b5a
  1. 6
      cgminer.c
  2. 1
      miner.h

6
cgminer.c

@ -5280,7 +5280,7 @@ static void gen_hash(unsigned char *data, unsigned char *hash, int len)
* 0x00000000ffff0000000000000000000000000000000000000000000000000000 * 0x00000000ffff0000000000000000000000000000000000000000000000000000
* so we use a big endian 64 bit unsigned integer centred on the 5th byte to * so we use a big endian 64 bit unsigned integer centred on the 5th byte to
* cover a huge range of difficulty targets, though not all 256 bits' worth */ * cover a huge range of difficulty targets, though not all 256 bits' worth */
static void set_work_target(struct work *work, double diff) void set_target(unsigned char *dest_target, double diff)
{ {
unsigned char target[32]; unsigned char target[32];
uint64_t *data64, h64; uint64_t *data64, h64;
@ -5315,7 +5315,7 @@ static void set_work_target(struct work *work, double diff)
applog(LOG_DEBUG, "Generated target %s", htarget); applog(LOG_DEBUG, "Generated target %s", htarget);
free(htarget); free(htarget);
} }
memcpy(work->target, target, 32); memcpy(dest_target, target, 32);
} }
/* Generates stratum based work based on the most recent notify information /* Generates stratum based work based on the most recent notify information
@ -5399,7 +5399,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
free(header); free(header);
calc_midstate(work); calc_midstate(work);
set_work_target(work, work->sdiff); set_target(work->target, work->sdiff);
local_work++; local_work++;
work->pool = pool; work->pool = pool;

1
miner.h

@ -894,6 +894,7 @@ extern pthread_cond_t restart_cond;
extern void thread_reportin(struct thr_info *thr); extern void thread_reportin(struct thr_info *thr);
extern void clear_stratum_shares(struct pool *pool); extern void clear_stratum_shares(struct pool *pool);
extern void set_target(unsigned char *dest_target, double diff);
extern int restart_wait(unsigned int mstime); extern int restart_wait(unsigned int mstime);
extern void kill_work(void); extern void kill_work(void);

Loading…
Cancel
Save