From 36e8d75faf26e0c178d5d7022c69d20f4154c41c Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 23 Feb 2016 17:08:55 -0800 Subject: [PATCH] remove old getMerkleRoot. --- lib/bcoin/block.js | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/lib/bcoin/block.js b/lib/bcoin/block.js index c65ee44c..46dedce7 100644 --- a/lib/bcoin/block.js +++ b/lib/bcoin/block.js @@ -201,38 +201,6 @@ Block.prototype._verifyPartial = function _verifyPartial() { return true; }; -Block.prototype.getMerkleRoot = function getMerkleRoot() { - var tree = []; - var i, j, size, i2, hash; - - assert(this.subtype === 'block'); - - for (i = 0; i < this.txs.length; i++) - tree.push(this.txs[i].hash()); - - j = 0; - size = this.txs.length; - - for (; size > 1; size = ((size + 1) / 2) | 0) { - for (i = 0; i < size; i += 2) { - i2 = Math.min(i + 1, size - 1); - if (i2 === i + 1 && i2 + 1 === size - && tree[j + i] === tree[j + i2]) { - return utils.toHex(constants.zeroHash); - } - hash = Buffer.concat([tree[j + i], tree[j + i2]]); - hash = utils.dsha256(hash); - tree.push(hash); - } - j += size; - } - - if (!tree.length) - return utils.toHex(constants.zeroHash); - - return utils.toHex(tree[tree.length - 1]); -}; - Block.prototype.getMerkleRoot = function getMerkleRoot() { var hashes = []; var i;