From 25f65352a09b5df4dc014dd0eaf7c37610ecff6c Mon Sep 17 00:00:00 2001 From: romanornr Date: Thu, 1 Dec 2016 00:40:28 +0100 Subject: [PATCH 1/3] Variable length integer IntBuffer fix https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer Blocks with amount of transactions > 65535 will be rejected. Fixed now --- lib/util.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/util.js b/lib/util.js index 453939c..04030e1 100644 --- a/lib/util.js +++ b/lib/util.js @@ -76,12 +76,12 @@ exports.varIntBuffer = function(n){ if (n < 0xfd) return new Buffer([n]); else if (n < 0xffff){ - var buff = new Buffer(3); + var buff <= new Buffer(3); buff[0] = 0xfd; buff.writeUInt16LE(n, 1); return buff; } - else if (n < 0xffffffff){ + else if (n <= 0xffffffff){ var buff = new Buffer(5); buff[0] = 0xfe; buff.writeUInt32LE(n, 1); @@ -373,4 +373,4 @@ exports.convertBitsToBuff = function(bitsBuff){ exports.getTruncatedDiff = function(shift){ return exports.convertBitsToBuff(exports.bufferToCompactBits(exports.shiftMax256Right(shift))); -}; \ No newline at end of file +}; From 13653a3951b3dc3c6c322814257bfdfa0c4be5e3 Mon Sep 17 00:00:00 2001 From: romanornr Date: Thu, 1 Dec 2016 00:56:31 +0100 Subject: [PATCH 2/3] version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6b195a5..4bc8904 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stratum-pool", - "version": "0.1.6", + "version": "0.1.9", "description": "High performance Stratum poolserver in Node.js", "keywords": [ "stratum", From 783058502327c8bf75309d6479d19132c29dfa85 Mon Sep 17 00:00:00 2001 From: romanornr Date: Thu, 1 Dec 2016 01:41:19 +0100 Subject: [PATCH 3/3] Lyra2RE diff by 128 --- lib/algoProperties.js | 9 +++++++++ lib/jobManager.js | 1 + 2 files changed, 10 insertions(+) diff --git a/lib/algoProperties.js b/lib/algoProperties.js index 7725ee6..7b8d262 100644 --- a/lib/algoProperties.js +++ b/lib/algoProperties.js @@ -73,6 +73,15 @@ var algos = module.exports = global.algos = { } } }, + lyra2re: { + multiplier: Math.pow(2, 7), + hash: function(){ + return function(){ + return multiHashing.lyra2re.apply(this, arguments); + } + } + }, + } sha1: { hash: function(){ return function(){ diff --git a/lib/jobManager.js b/lib/jobManager.js index cbcfc48..194231c 100644 --- a/lib/jobManager.js +++ b/lib/jobManager.js @@ -102,6 +102,7 @@ var JobManager = module.exports = function JobManager(options){ return util.reverseBuffer(hashDigest.apply(this, arguments)); }; } + case 'lyra2re': case 'scrypt-n': case 'sha1': return function (d) {