Browse Source

Remove workpadding

pull/1/head
elbandi 8 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]; @@ -1240,7 +1240,6 @@ extern char current_hash[68];
extern double current_diff;
extern double best_diff;
extern struct timeval block_timeval;
extern char *workpadding;
//config options table
extern struct opt_table opt_config_table[];

5
sgminer.c

@ -1944,7 +1944,6 @@ void free_work(struct work *w) @@ -1944,7 +1944,6 @@ void free_work(struct work *w)
}
static void calc_diff(struct work *work, double known);
char *workpadding = "000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000";
#ifdef HAVE_LIBCURL
/* 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) @@ -2139,9 +2138,7 @@ static void gen_gbt_work(struct pool *pool, struct work *work)
flip32(work->data + 4 + 32, merkleroot);
free(merkleroot);
memset(work->data + 4 + 32 + 32 + 4 + 4, 0, 4); /* nonce */
hex2bin(work->data + 4 + 32 + 32 + 4 + 4 + 4, workpadding, 48);
memset(work->data + 4 + 32 + 32 + 4 + 4, 0, 4 + 48); /* nonce + padding */
if (opt_debug) {
char *header = bin2hex(work->data, 128);

23
util.c

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

Loading…
Cancel
Save