From c9ead893cd4430ed78b82a5d77437a132568ce11 Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Fri, 14 Jul 2017 02:46:23 -0700 Subject: [PATCH] Update to fix bug with the way that xmr-stak accepts jobs and the BT changes from the XMR pools. --- lib/coins/xmr.js | 1 + lib/pool.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/coins/xmr.js b/lib/coins/xmr.js index 40ba728..e07c280 100644 --- a/lib/coins/xmr.js +++ b/lib/coins/xmr.js @@ -118,6 +118,7 @@ function Coin(data){ // Set this.blob equal to the BT blob that we get from upstream. this.blob = template.blocktemplate_blob; + this.idHash = crypto.createHash('md5').update(template.blocktemplate_blob).digest('hex'); // Set this.diff equal to the known diff for this block. this.difficulty = template.difficulty; // Set this.height equal to the known height for this block. diff --git a/lib/pool.js b/lib/pool.js index cb46570..de2912f 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -469,7 +469,7 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer }; this.getJob = function () { - if (this.lastBlockHeight === activeBlockTemplate.height && !this.newDiff && this.cachedJob !== null) { + if (this.lastBlockHeight === activeBlockTemplate.height && activeBlockTemplate.idHash === this.validJobs.get(0).blockHash && !this.newDiff && this.cachedJob !== null) { return this.cachedJob; } @@ -485,7 +485,8 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer height: activeBlockTemplate.height, difficulty: this.difficulty, diffHex: this.diffHex, - submissions: [] + submissions: [], + blockHash: activeBlockTemplate.idHash }; this.validJobs.enq(newJob); @@ -892,7 +893,7 @@ if (cluster.isMaster) { socket.on('data', function (d) { dataBuffer += d; - if (Buffer.byteLength(dataBuffer, 'utf8') > 102400) { //10KB + if (Buffer.byteLength(dataBuffer, 'utf8') > 10240) { //10KB dataBuffer = null; console.warn(threadName + 'Excessive packet size from: ' + socket.remoteAddress); socket.destroy();