From 2821fc477a223ca9d39de65287bdc7b2a99a71db Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Wed, 13 Dec 2017 08:29:49 -0800 Subject: [PATCH] Fix for the 300 msec template bug identified by Mayday30. Thanks for the catch! --- lib/pool.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/pool.js b/lib/pool.js index d5f938a..c61c911 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -171,11 +171,10 @@ function templateUpdate(repeating) { newBlockTemplate(rpcResponse); } } - if (repeating !== false) { + } else { + if (repeating !== true) { setTimeout(templateUpdate, 300); } - } else { - setTimeout(templateUpdate, 300, false); } }); } @@ -644,14 +643,14 @@ function processShare(miner, job, blockTemplate, params) { console.error(threadName + "Error submitting block at height " + job.height + " from " + miner.logString + ", share type: " + shareType + " error: " + JSON.stringify(rpcResult.error)); recordShareData(miner, job, hashDiff.toString(), false, null, shareType); // Error on submit, so we'll submit a sanity check for good measure. - templateUpdate(false); + templateUpdate(); } else if (rpcResult) { //Success! Submitted a block without an issue. let blockFastHash = global.coinFuncs.getBlockID(shareBuffer).toString('hex'); console.log(threadName + "Block " + blockFastHash.substr(0, 6) + " found at height " + job.height + " by " + miner.logString + ", share type: " + shareType + " - submit result: " + JSON.stringify(rpcResult.result)); recordShareData(miner, job, hashDiff.toString(), true, blockFastHash, shareType, blockTemplate); - templateUpdate(false); + templateUpdate(); } else { // RPC bombed out massively. console.error(threadName + "RPC Error. Please check logs for details"); @@ -856,14 +855,15 @@ if (cluster.isMaster) { workerList.push(worker); }); templateUpdate(); + setInterval(templateUpdate, 300, true); global.support.sendEmail(global.config.general.adminEmail, "Pool server " + global.config.hostname + " online", "The pool server: " + global.config.hostname + " with IP: " + global.config.bind_ip + " is online"); } else { setInterval(checkAliveMiners, 30000); setInterval(retargetMiners, global.config.pool.retargetTime * 1000); - templateUpdate(false); + templateUpdate(); setInterval(function () { bannedIPs = []; - templateUpdate(false); + templateUpdate(); }, 60000); async.each(global.config.ports, function (portData) { if (global.config[portData.portType].enable !== true) {