diff --git a/lib/pool.js b/lib/pool.js index bba0454d7..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); @@ -366,10 +362,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; @@ -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){