Skip to content
Permalink
Browse files

Fix for sapling

  • Loading branch information...
okoto-xyz committed Sep 22, 2018
1 parent e07dc1c commit 7e78d84986a1325ad10a8b38b386e11573bb71a8
Showing with 4 additions and 6 deletions.
  1. +3 −5 cpu-miner.c
  2. +1 −1 util.c
@@ -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 {
2 util.c
@@ -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) {

0 comments on commit 7e78d84

Please sign in to comment.
You can’t perform that action at this time.