Fix for the 300 msec template bug identified by Mayday30. Thanks for the catch!

This commit is contained in:
Alexander Blair 2017-12-13 08:29:49 -08:00
parent 6a083229b9
commit 2821fc477a

View file

@ -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) {