Browse Source

Remove workpadding

pull/1/head
elbandi 9 years ago
parent
commit
34a8140eb6
  1. 1
      miner.h
  2. 5
      sgminer.c
  3. 23
      util.c

1
miner.h

@ -1240,7 +1240,6 @@ extern char current_hash[68];
extern double current_diff; extern double current_diff;
extern double best_diff; extern double best_diff;
extern struct timeval block_timeval; extern struct timeval block_timeval;
extern char *workpadding;
//config options table //config options table
extern struct opt_table opt_config_table[]; extern struct opt_table opt_config_table[];

5
sgminer.c

@ -1944,7 +1944,6 @@ void free_work(struct work *w)
} }
static void calc_diff(struct work *work, double known); static void calc_diff(struct work *work, double known);
char *workpadding = "000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000";
#ifdef HAVE_LIBCURL #ifdef HAVE_LIBCURL
/* Process transactions with GBT by storing the binary value of the first /* Process transactions with GBT by storing the binary value of the first
@ -2139,9 +2138,7 @@ static void gen_gbt_work(struct pool *pool, struct work *work)
flip32(work->data + 4 + 32, merkleroot); flip32(work->data + 4 + 32, merkleroot);
free(merkleroot); free(merkleroot);
memset(work->data + 4 + 32 + 32 + 4 + 4, 0, 4); /* nonce */ memset(work->data + 4 + 32 + 32 + 4 + 4, 0, 4 + 48); /* nonce + padding */
hex2bin(work->data + 4 + 32 + 32 + 4 + 4 + 4, workpadding, 48);
if (opt_debug) { if (opt_debug) {
char *header = bin2hex(work->data, 128); char *header = bin2hex(work->data, 128);

23
util.c

@ -1506,7 +1506,7 @@ static bool parse_notify(struct pool *pool, json_t *val)
{ {
char *job_id, *prev_hash, *coinbase1, *coinbase2, *bbversion, *nbit, char *job_id, *prev_hash, *coinbase1, *coinbase2, *bbversion, *nbit,
*ntime, *header; *ntime, *header;
size_t cb1_len, cb2_len, alloc_len; size_t cb1_len, cb2_len, alloc_len, header_len;
unsigned char *cb1, *cb2; unsigned char *cb1, *cb2;
bool clean, ret = false; bool clean, ret = false;
int merkles, i; int merkles, i;
@ -1586,25 +1586,20 @@ static bool parse_notify(struct pool *pool, json_t *val)
pool->nonce2 = 0; pool->nonce2 = 0;
pool->merkle_offset = strlen(pool->swork.bbversion) + pool->merkle_offset = strlen(pool->swork.bbversion) +
strlen(pool->swork.prev_hash); strlen(pool->swork.prev_hash);
pool->swork.header_len = pool->merkle_offset +
/* merkle_hash */ 32 +
strlen(pool->swork.ntime) +
strlen(pool->swork.nbit) +
/* nonce */ 8 +
/* workpadding */ 96;
pool->merkle_offset /= 2; pool->merkle_offset /= 2;
pool->swork.header_len = pool->swork.header_len * 2 + 1; header = (char *)alloca(257);
align_len(&pool->swork.header_len); snprintf(header, 257,
header = (char *)alloca(pool->swork.header_len); "%s%s%s%s%s%s",
snprintf(header, pool->swork.header_len,
"%s%s%s%s%s%s%s",
pool->swork.bbversion, pool->swork.bbversion,
pool->swork.prev_hash, pool->swork.prev_hash,
blank_merkel, blank_merkel,
pool->swork.ntime, pool->swork.ntime,
pool->swork.nbit, pool->swork.nbit,
"00000000", /* nonce */ "00000000" /* nonce */
workpadding); );
header_len = strlen(header);
memset(header + header_len, '0', 256 - header_len);
header[256] = '\0';
if (unlikely(!hex2bin(pool->header_bin, header, 128))) { if (unlikely(!hex2bin(pool->header_bin, header, 128))) {
applog(LOG_WARNING, "%s: Failed to convert header to header_bin, got %s", __func__, header); applog(LOG_WARNING, "%s: Failed to convert header to header_bin, got %s", __func__, header);
pool_failed(pool); pool_failed(pool);

Loading…
Cancel
Save