Another fix where vardiff was breaking things

This commit is contained in:
Matt 2014-03-20 12:20:08 -06:00
parent b2052b6fbd
commit b965b2d61d
2 changed files with 4 additions and 2 deletions

View File

@ -77,7 +77,8 @@ var pool = module.exports = function pool(options, authorizeFn){
function SetupVarDiff(){ function SetupVarDiff(){
Object.keys(options.ports).forEach(function(port) { Object.keys(options.ports).forEach(function(port) {
_this.setVarDiff(port, new varDiff(port, options.ports[port].varDiff)); if (options.ports[port].varDiff)
_this.setVarDiff(port, new varDiff(port, options.ports[port].varDiff));
}); });
} }
@ -416,6 +417,7 @@ var pool = module.exports = function pool(options, authorizeFn){
var processedNewBlock = _this.jobManager.processTemplate(result.response, publicKeyBuffer); var processedNewBlock = _this.jobManager.processTemplate(result.response, publicKeyBuffer);
if (processedNewBlock) { if (processedNewBlock) {
Object.keys(_this.varDiff).forEach(function(port){ Object.keys(_this.varDiff).forEach(function(port){
_this.varDiff[port].setNetworkDifficulty(_this.jobManager.currentJob.difficulty); _this.varDiff[port].setNetworkDifficulty(_this.jobManager.currentJob.difficulty);
}); });

View File

@ -48,7 +48,7 @@ var varDiff = module.exports = function varDiff(port, varDiffOptions){
var bufferSize, tMin, tMax; var bufferSize, tMin, tMax;
if (!varDiffOptions) return; //if (!varDiffOptions) return;
var variance = varDiffOptions.targetTime * (varDiffOptions.variancePercent / 100); var variance = varDiffOptions.targetTime * (varDiffOptions.variancePercent / 100);