Perma-adding Atrides fix + setting the target for the proxied clients to 1/10th of normal.

This commit is contained in:
Alexander Blair
2017-07-04 13:35:33 -07:00
parent 93f64201a9
commit 687decc04d
+9 -3
View File
@@ -394,7 +394,13 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
this.updateDifficulty = function(){ this.updateDifficulty = function(){
if (this.hashes > 0) { if (this.hashes > 0) {
this.setNewDiff(Math.floor(this.hashes / (Math.floor((Date.now() - this.connectTime) / 1000))) * global.config.pool.targetTime); let newDiff = 0;
if (this.proxy){
newDiff = Math.floor(Math.floor(this.hashes / (Math.floor((Date.now() - this.connectTime) / 1000))) * global.config.pool.targetTime/10);
} else {
newDiff = Math.floor(this.hashes / (Math.floor((Date.now() - this.connectTime) / 1000))) * global.config.pool.targetTime;
}
this.setNewDiff(newDiff);
} else { } else {
this.updateDifficultyOld(); this.updateDifficultyOld();
} }
@@ -403,7 +409,7 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
this.setNewDiff = function (difficulty) { this.setNewDiff = function (difficulty) {
this.newDiff = Math.round(difficulty); this.newDiff = Math.round(difficulty);
debug(threadName + "Difficulty: " + this.newDiff + " For: " + this.logString + " Time Average: " + this.shareTimeBuffer.average(this.lastShareTime) + " Entries: " + this.shareTimeBuffer.size() + " Sum: " + this.shareTimeBuffer.sum()); debug(threadName + "Difficulty: " + this.newDiff + " For: " + this.logString + " Time Average: " + this.shareTimeBuffer.average(this.lastShareTime) + " Entries: " + this.shareTimeBuffer.size() + " Sum: " + this.shareTimeBuffer.sum());
if (this.newDiff > global.config.pool.maxDifficulty) { if (this.newDiff > global.config.pool.maxDifficulty && !this.proxy) {
this.newDiff = global.config.pool.maxDifficulty; this.newDiff = global.config.pool.maxDifficulty;
} }
if (this.difficulty === this.newDiff) { if (this.difficulty === this.newDiff) {
@@ -876,7 +882,7 @@ if (cluster.isMaster) {
socket.on('data', function (d) { socket.on('data', function (d) {
dataBuffer += d; dataBuffer += d;
if (Buffer.byteLength(dataBuffer, 'utf8') > 10240) { //10KB if (Buffer.byteLength(dataBuffer, 'utf8') > 102400) { //10KB
dataBuffer = null; dataBuffer = null;
console.warn(threadName + 'Excessive packet size from: ' + socket.remoteAddress); console.warn(threadName + 'Excessive packet size from: ' + socket.remoteAddress);
socket.destroy(); socket.destroy();