diff --git a/src/block.js b/src/block.js index 23ae976..8e608e8 100644 --- a/src/block.js +++ b/src/block.js @@ -2,6 +2,8 @@ var bufferutils = require('./bufferutils') var bcrypto = require('./crypto') var bufferReverse = require('buffer-reverse') var fastMerkleRoot = require('merkle-lib/fastRoot') +var typeforce = require('typeforce') +var types = require('./types') var Transaction = require('./transaction') @@ -134,6 +136,7 @@ Block.calculateTarget = function (bits) { } Block.calculateMerkleRoot = function (transactions) { + typeforce([{ getHash: types.Function }], transactions) if (transactions.length === 0) throw TypeError('Cannot compute merkle root for zero transactions') var hashes = transactions.map(function (transaction) {