diff --git a/lib/primitives/merkleblock.js b/lib/primitives/merkleblock.js index 724f5ca6..47b93543 100644 --- a/lib/primitives/merkleblock.js +++ b/lib/primitives/merkleblock.js @@ -196,7 +196,7 @@ MerkleBlock.prototype.extractTree = function extractTree() { var indexes = []; var map = {}; var failed = false; - var hashes = []; + var hashes = this.hashes; var flags = this.flags; var totalTX = this.totalTX; var height = 0; @@ -253,15 +253,12 @@ MerkleBlock.prototype.extractTree = function extractTree() { if (totalTX > consensus.MAX_BLOCK_SIZE / 60) throw new Error('Too many transactions.'); - if (this.hashes.length > totalTX) + if (hashes.length > totalTX) throw new Error('Too many hashes.'); - if (flags.length * 8 < this.hashes.length) + if (flags.length * 8 < hashes.length) throw new Error('Flags too small.'); - for (p = 0; p < this.hashes.length; p++) - hashes.push(this.hashes[p]); - while (width(height) > 1) height++;