Skip to content

Commit

Permalink
Fix for sapling
Browse files Browse the repository at this point in the history
  • Loading branch information
okoto-xyz committed Sep 22, 2018
1 parent 41eb1c2 commit 3cc09c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions cpu-miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -1073,19 +1073,17 @@ static void stratum_gen_work(struct stratum_ctx *sctx, struct work *work)

/* Assemble block header */
memset(work->data, 0, 160);
work->sapling = be32dec(sctx->job.version) == 5 ? true : false;
work->data[0] = le32dec(sctx->job.version);
work->sapling = work->data[0] == 5 ? true : false;
for (i = 0; i < 8; i++)
work->data[1 + i] = le32dec((uint32_t *)sctx->job.prevhash + i);
if (work->sapling) {
for (i = 0; i < 8; i++)
work->data[27 + i] = le32dec((uint32_t *)sctx->job.finalsaplinghash + i);
}
for (i = 0; i < 8; i++)
work->data[9 + i] = be32dec((uint32_t *)merkle_root + i);
work->data[17] = le32dec(sctx->job.ntime);
work->data[18] = le32dec(sctx->job.nbits);
if (work->sapling) {
for (i = 0; i < 8; i++)
work->data[20 + i] = le32dec((uint32_t *)sctx->job.finalsaplinghash + i);
work->data[28] = 0x80000000;
work->data[39] = 0x00000280;
} else {
Expand Down
2 changes: 1 addition & 1 deletion util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params)
goto out;
}
hex2bin(sctx->job.version, version, 4);
ver = le32dec(sctx->job.version);
ver = be32dec(sctx->job.version);
if (ver == 5) {
finalsaplinghash = json_string_value(json_array_get(params, 9));
if (!finalsaplinghash || strlen(finalsaplinghash) != 64) {
Expand Down

0 comments on commit 3cc09c8

Please sign in to comment.