restore typeforce with Buffer hash instead of Function getHash
This commit is contained in:
parent
5a60a03066
commit
1e095d487d
@ -1,8 +1,8 @@
|
|||||||
var Buffer = require('safe-buffer').Buffer
|
var Buffer = require('safe-buffer').Buffer
|
||||||
var bcrypto = require('./crypto')
|
var bcrypto = require('./crypto')
|
||||||
var fastMerkleRoot = require('merkle-lib/fastRoot')
|
var fastMerkleRoot = require('merkle-lib/fastRoot')
|
||||||
// var typeforce = require('typeforce')
|
var typeforce = require('typeforce')
|
||||||
// var types = require('./types')
|
var types = require('./types')
|
||||||
var varuint = require('varuint-bitcoin')
|
var varuint = require('varuint-bitcoin')
|
||||||
|
|
||||||
var Transaction = require('./transaction')
|
var Transaction = require('./transaction')
|
||||||
@ -150,7 +150,7 @@ Block.calculateTarget = function (bits) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Block.calculateMerkleRoot = function (transactions) {
|
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')
|
if (transactions.length === 0) throw TypeError('Cannot compute merkle root for zero transactions')
|
||||||
|
|
||||||
var hashes = transactions.map(function (transaction) {
|
var hashes = transactions.map(function (transaction) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user