restore typeforce with Buffer hash instead of Function getHash

This commit is contained in:
junderw 2018-05-22 18:51:21 +09:00
parent 5a60a03066
commit 1e095d487d
No known key found for this signature in database
GPG Key ID: B256185D3A971908

View File

@ -1,8 +1,8 @@
var Buffer = require('safe-buffer').Buffer
var bcrypto = require('./crypto')
var fastMerkleRoot = require('merkle-lib/fastRoot')
// var typeforce = require('typeforce')
// var types = require('./types')
var typeforce = require('typeforce')
var types = require('./types')
var varuint = require('varuint-bitcoin')
var Transaction = require('./transaction')
@ -150,7 +150,7 @@ Block.calculateTarget = function (bits) {
}
Block.calculateMerkleRoot = function (transactions) {
// typeforce([{ getHash: types.Function }], transactions) ToDo: What should this be?
typeforce([{ hash: types.Buffer }], transactions)
if (transactions.length === 0) throw TypeError('Cannot compute merkle root for zero transactions')
var hashes = transactions.map(function (transaction) {