mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-17 05:21:27 +02:00
Update to the pool to ensure that we can't "queue up" multiple GBT's.
This commit is contained in:
+8
-5
@@ -133,7 +133,7 @@ function checkAliveMiners() {
|
||||
}
|
||||
}
|
||||
|
||||
function templateUpdate() {
|
||||
function templateUpdate(repeating) {
|
||||
global.coinFuncs.getBlockTemplate(global.config.pool.address, function (rpcResponse) {
|
||||
if (rpcResponse) {
|
||||
rpcResponse = rpcResponse.result;
|
||||
@@ -150,6 +150,9 @@ function templateUpdate() {
|
||||
newBlockTemplate(rpcResponse);
|
||||
}
|
||||
}
|
||||
if (repeating !== false){
|
||||
setTimeout(templateUpdate, 300);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -524,14 +527,14 @@ function processShare(miner, job, blockTemplate, nonce, resultHash) {
|
||||
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();
|
||||
templateUpdate(false);
|
||||
} 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();
|
||||
templateUpdate(false);
|
||||
} else {
|
||||
// RPC bombed out massively.
|
||||
console.error(threadName + "RPC Error. Please check logs for details");
|
||||
@@ -702,12 +705,12 @@ if (cluster.isMaster) {
|
||||
worker.on('message', messageHandler);
|
||||
workerList.push(worker);
|
||||
});
|
||||
setInterval(templateUpdate, 300);
|
||||
templateUpdate();
|
||||
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();
|
||||
templateUpdate(false);
|
||||
setInterval(function () {
|
||||
bannedIPs = [];
|
||||
}, 60000);
|
||||
|
||||
Reference in New Issue
Block a user