From 67b1321b63f0f1c68354b90fb178c247601bef62 Mon Sep 17 00:00:00 2001 From: DurinsMine <40305022+DurinsMine@users.noreply.github.com> Date: Fri, 15 Jun 2018 20:46:08 +0100 Subject: [PATCH 1/3] Wait for daemon before GetBlockHeader Do nothing if daemon has already been queried for block header --- lib/worker.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/worker.js b/lib/worker.js index 1a0e5459..e839d6f9 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -430,12 +430,16 @@ function updatePoolInformation() { }); } +var getBlockHeaders = false; function updateBlockHeader() { - // Todo: Implement within the coins/.js file. +if(getBlockHeaders == false){ global.support.rpcDaemon('getlastblockheader', [], function (body) { + getBlockHeaders = true; if (typeof body.error !== 'undefined'){ + getBlockHeaders = false; return console.error(`Issue getting last block header: ${JSON.stringify(body)}`); } + if (body.result && body.result.block_header.hash !== lastBlockHash) { lastBlockHash = body.result.block_header.hash; global.database.setCache('networkBlockInfo', { @@ -445,12 +449,19 @@ function updateBlockHeader() { value: body.result.block_header.reward, ts: body.result.block_header.timestamp }); - } else if (body.result.block_header.hash === lastBlockHash) { + getBlockHeaders = false; + + } else if (body.result && body.result.block_header.hash === lastBlockHash) { console.log("Block headers identical to historical header. Ignoring"); + getBlockHeaders = false; } else { console.error("GetLastBlockHeader Error during block header update"); + getBlockHeaders = false; } }); + }else{ + console.log("GetBlockHeader: Waiting for reply from daemon"); + } } function updateWalletStats() { From e2616a8d374c999577637c31de898693374a8acc Mon Sep 17 00:00:00 2001 From: DM Date: Mon, 29 Oct 2018 20:39:55 +0000 Subject: [PATCH 2/3] Revert "Wait for daemon before GetBlockHeader" This reverts commit 67b1321b63f0f1c68354b90fb178c247601bef62. --- lib/worker.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/lib/worker.js b/lib/worker.js index e839d6f9..1a0e5459 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -430,16 +430,12 @@ function updatePoolInformation() { }); } -var getBlockHeaders = false; function updateBlockHeader() { -if(getBlockHeaders == false){ + // Todo: Implement within the coins/.js file. global.support.rpcDaemon('getlastblockheader', [], function (body) { - getBlockHeaders = true; if (typeof body.error !== 'undefined'){ - getBlockHeaders = false; return console.error(`Issue getting last block header: ${JSON.stringify(body)}`); } - if (body.result && body.result.block_header.hash !== lastBlockHash) { lastBlockHash = body.result.block_header.hash; global.database.setCache('networkBlockInfo', { @@ -449,19 +445,12 @@ if(getBlockHeaders == false){ value: body.result.block_header.reward, ts: body.result.block_header.timestamp }); - getBlockHeaders = false; - - } else if (body.result && body.result.block_header.hash === lastBlockHash) { + } else if (body.result.block_header.hash === lastBlockHash) { console.log("Block headers identical to historical header. Ignoring"); - getBlockHeaders = false; } else { console.error("GetLastBlockHeader Error during block header update"); - getBlockHeaders = false; } }); - }else{ - console.log("GetBlockHeader: Waiting for reply from daemon"); - } } function updateWalletStats() { From 7395ad4711a49c687ca590d1f4673f7eaf8647cc Mon Sep 17 00:00:00 2001 From: DM Date: Mon, 29 Oct 2018 20:54:47 +0000 Subject: [PATCH 3/3] Add Aeon fork No height yet so set to 9.99 million until we know --- lib/coins/aeon-rebase.js | 3 ++- lib/coins/aeon.js | 1 + lib/coins/krb.js | 1 + lib/coins/xmr.js | 1 + lib/pool.js | 2 +- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/coins/aeon-rebase.js b/lib/coins/aeon-rebase.js index 5517c3f3..be039bd1 100644 --- a/lib/coins/aeon-rebase.js +++ b/lib/coins/aeon-rebase.js @@ -9,6 +9,7 @@ let hexChars = new RegExp("[0-9a-f]+"); function Coin(data){ this.isxmr = false; + this.isaeon = true; this.bestExchange = global.config.payout.bestExchange; this.data = data; let instanceId = crypto.randomBytes(4); @@ -157,7 +158,7 @@ function Coin(data){ }; this.cryptoNight = function(convertedBlob) { - return multiHashing.cryptonight_light(convertedBlob, convertedBlob[0] >= 7 ? convertedBlob[0] - 6 : 0); + return multiHashing.cryptonight_light(convertedBlob, convertedBlob[0] >= 8 ? 8 : 1); } } diff --git a/lib/coins/aeon.js b/lib/coins/aeon.js index 825155b2..086d3b17 100644 --- a/lib/coins/aeon.js +++ b/lib/coins/aeon.js @@ -9,6 +9,7 @@ let hexChars = new RegExp("[0-9a-f]+"); function Coin(data){ this.isxmr = false; + this.isaeon = false; this.bestExchange = global.config.payout.bestExchange; this.data = data; let instanceId = crypto.randomBytes(4); diff --git a/lib/coins/krb.js b/lib/coins/krb.js index 5bbc020b..7b713b4f 100644 --- a/lib/coins/krb.js +++ b/lib/coins/krb.js @@ -9,6 +9,7 @@ let hexChars = new RegExp("[0-9a-f]+"); function Coin(data){ this.isxmr = false; + this.isaeon = false; this.bestExchange = global.config.payout.bestExchange; this.data = data; let instanceId = crypto.randomBytes(4); diff --git a/lib/coins/xmr.js b/lib/coins/xmr.js index 5cc12441..7a5cfec5 100644 --- a/lib/coins/xmr.js +++ b/lib/coins/xmr.js @@ -9,6 +9,7 @@ let hexChars = new RegExp("[0-9a-f]+"); function Coin(data){ this.isxmr = true; + this.isaeon = false; this.bestExchange = global.config.payout.bestExchange; this.data = data; let instanceId = crypto.randomBytes(4); diff --git a/lib/pool.js b/lib/pool.js index 323c9f03..4acbc0bb 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -625,7 +625,7 @@ function processShare(miner, job, blockTemplate, params, sendReply) { shareType = false; } if (hash.toString('hex') !== resultHash) { - if (job.height >= 1546000 && coinFuncs.isxmr) { + if ((job.height >= 1546000 && coinFuncs.isxmr) || (job.height >= 9999999 && coinFuncs.isaeon)) { hash = multiHashing.cryptonight(convertedBlob, 0); if (hash.toString("hex") === resultHash) { console.error(threadName + "Bad hashing algo (CN/0) from miner " + miner.logString);