Vardiff perfect fix
This commit is contained in:
parent
96cfc412a8
commit
9d8255a620
|
@ -284,7 +284,7 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||
}).on('submit', function(params, resultCallback){
|
||||
var result =_this.jobManager.processShare(
|
||||
params.jobId,
|
||||
client.difficulty,
|
||||
client.currentDifficulty,
|
||||
client.extraNonce1,
|
||||
params.extraNonce2,
|
||||
params.nTime,
|
||||
|
|
|
@ -139,9 +139,9 @@ var StratumClient = function(options){
|
|||
});
|
||||
}
|
||||
);
|
||||
if (_this.lastEmittedDiff !== _this.difficulty){
|
||||
_this.lastEmittedDiff = _this.difficulty
|
||||
_this.emit('difficultyChanged', _this.difficulty);
|
||||
if (_this.lastEmittedDiff !== _this.currentDifficulty){
|
||||
_this.lastEmittedDiff = _this.currentDifficulty
|
||||
_this.emit('difficultyChanged', _this.currentDifficulty);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ var StratumClient = function(options){
|
|||
}
|
||||
|
||||
if (difficulty !== this.difficulty) {
|
||||
this.difficulty = difficulty;
|
||||
_this.latestDifficulty = difficulty;
|
||||
sendJson({
|
||||
id : null,
|
||||
method: "mining.set_difficulty",
|
||||
|
@ -226,6 +226,7 @@ var StratumClient = function(options){
|
|||
method: "mining.notify",
|
||||
params: jobParams
|
||||
});
|
||||
_this.currentDifficulty = _this.latestDifficulty
|
||||
};
|
||||
};
|
||||
StratumClient.prototype.__proto__ = events.EventEmitter.prototype;
|
||||
|
|
|
@ -78,7 +78,7 @@ var varDiff = module.exports = function varDiff(options, poolDifficulty){
|
|||
lastRtc = ts - options.retargetTime / 2;
|
||||
lastTs = ts;
|
||||
timeBuffer = new RingBuffer(bufferSize);
|
||||
console.log(bufferSize+ ' first time share vardiff curdiff: '+client.difficulty);
|
||||
console.log(bufferSize+ ' first time share vardiff curdiff: '+client.currentDifficulty);
|
||||
return;
|
||||
}
|
||||
var sinceLast = ts - lastTs;
|
||||
|
@ -97,10 +97,10 @@ var varDiff = module.exports = function varDiff(options, poolDifficulty){
|
|||
|
||||
var ddiff;
|
||||
|
||||
if (avg > tMax && client.difficulty > options.minDifficulty) {
|
||||
if (avg > tMax && client.currentDifficulty > options.minDifficulty) {
|
||||
ddiff = 0.5;
|
||||
if (ddiff * client.difficulty < options.minDifficulty) {
|
||||
ddiff = options.minDifficulty / client.difficulty;
|
||||
if (ddiff * client.currentDifficulty < options.minDifficulty) {
|
||||
ddiff = options.minDifficulty / client.currentDifficulty;
|
||||
}
|
||||
} else if (avg < tMin) {
|
||||
ddiff = 2;
|
||||
|
@ -119,7 +119,7 @@ var varDiff = module.exports = function varDiff(options, poolDifficulty){
|
|||
return;
|
||||
}
|
||||
|
||||
var newDiff = client.difficulty * ddiff;
|
||||
var newDiff = client.currentDifficulty * ddiff;
|
||||
timeBuffer.clear();
|
||||
|
||||
//console.log('sending new difficutly ' + newDiff);
|
||||
|
|
Loading…
Reference in New Issue