From dd23be73ad2ff75731f8621b0ce792987636553c Mon Sep 17 00:00:00 2001 From: CliffordST Date: Thu, 3 Jul 2014 14:38:31 +0400 Subject: [PATCH 1/2] Major update! Added support for FantomCoin blocks Use it strictly with the last updates from node-cryptonote-util --- lib/pool.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pool.js b/lib/pool.js index bba0454d7..6788d17dc 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -366,10 +366,10 @@ function recordShareData(miner, job, shareDiff, blockCandidate, hashHex, shareTy } function processShare(miner, job, blockTemplate, nonce, resultHash){ - var shareBuffer = new Buffer(blockTemplate.buffer.length); - blockTemplate.buffer.copy(shareBuffer); - shareBuffer.writeUInt32BE(job.extraNonce, blockTemplate.reserveOffset); - new Buffer(nonce, 'hex').copy(shareBuffer, 39); + var template = new Buffer(blockTemplate.buffer.length); + blockTemplate.buffer.copy(template); + template.writeUInt32BE(job.extraNonce, blockTemplate.reserveOffset); + var shareBuffer = cnUtil.construct_block_blob(template, new Buffer(nonce, 'hex')); var convertedBlob; var hash; From 5448dcfccdf293d0461a04992a72618cc99e8509 Mon Sep 17 00:00:00 2001 From: CliffordST Date: Thu, 3 Jul 2014 20:12:09 +0400 Subject: [PATCH 2/2] Fix error with calculating FantomCoin block ID --- lib/pool.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/pool.js b/lib/pool.js index 6788d17dc..377d795af 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -22,10 +22,6 @@ var log = function(severity, system, text, data){ var cryptoNight = multiHashing['cryptonight']; -function cryptoNightFast(buf) { - return cryptoNight(Buffer.concat([new Buffer([buf.length]), buf]), true); -} - var diff1 = bignum('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', 16); var instanceId = crypto.randomBytes(4); @@ -399,7 +395,7 @@ function processShare(miner, job, blockTemplate, nonce, resultHash){ var blockFastHash; if (hashDiff.ge(blockTemplate.difficulty)){ - blockFastHash = cryptoNightFast(convertedBlob || cnUtil.convert_blob(shareBuffer)).toString('hex'); + blockFastHash = cnUtil.get_block_id(shareBuffer).toString('hex'); apiInterfaces.rpcDaemon('submitblock', [shareBuffer.toString('hex')], function(error, result){ if (error){