mirror of
https://github.com/GOSTSec/ccminer
synced 2025-01-09 06:18:07 +00:00
decred: last vote bit should not be changed
This commit is contained in:
parent
fbd30f784c
commit
838f108dd4
10
ccminer.cpp
10
ccminer.cpp
@ -659,7 +659,10 @@ static bool work_decode(const json_t *val, struct work *work)
|
||||
cbin2hex(work->job_id, (const char*)&work->data[17], 4);
|
||||
|
||||
if (opt_algo == ALGO_DECRED) {
|
||||
uint16_t vote = (opt_vote << 1) | 1;
|
||||
uint16_t vote;
|
||||
// always keep last bit of votebits
|
||||
memcpy(&vote, &work->data[25], 2);
|
||||
vote = (opt_vote << 1) | (vote & 1);
|
||||
memcpy(&work->data[25], &vote, 2);
|
||||
// some random extradata to make it unique
|
||||
work->data[36] = (rand()*4);
|
||||
@ -1395,11 +1398,14 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
|
||||
work->data[1 + i] = le32dec((uint32_t *)sctx->job.prevhash + i);
|
||||
|
||||
if (opt_algo == ALGO_DECRED) {
|
||||
uint16_t vote = (opt_vote << 1) | 1;
|
||||
uint16_t vote;
|
||||
for (i = 0; i < 8; i++) // reversed prevhash
|
||||
work->data[1 + i] = swab32(work->data[1 + i]);
|
||||
// decred header (coinb1) [merkle...nonce]
|
||||
memcpy(&work->data[9], sctx->job.coinbase, 108);
|
||||
// last vote bit should never be changed
|
||||
memcpy(&vote, &work->data[25], 2);
|
||||
vote = (opt_vote << 1) | (vote & 1);
|
||||
memcpy(&work->data[25], &vote, 2);
|
||||
// extradata
|
||||
if (sctx->xnonce1_size > sizeof(work->data)-(36*4)) {
|
||||
|
Loading…
Reference in New Issue
Block a user