|
@ -155,7 +155,7 @@ MerkleBlock.prototype.validMerkleTree = function validMerkleTree() { |
|
|
* Return a list of all the txs hash that match the filter |
|
|
* Return a list of all the txs hash that match the filter |
|
|
* @returns {Array} - txs hash that match the filter |
|
|
* @returns {Array} - txs hash that match the filter |
|
|
*/ |
|
|
*/ |
|
|
MerkleBlock.prototype.filterdTxsHash = function validMerkleTree() { |
|
|
MerkleBlock.prototype.filterdTxsHash = function filterdTxsHash() { |
|
|
$.checkState(_.isArray(this.flags), 'MerkleBlock flags is not an array'); |
|
|
$.checkState(_.isArray(this.flags), 'MerkleBlock flags is not an array'); |
|
|
$.checkState(_.isArray(this.hashes), 'MerkleBlock hashes is not an array'); |
|
|
$.checkState(_.isArray(this.hashes), 'MerkleBlock hashes is not an array'); |
|
|
|
|
|
|
|
@ -169,6 +169,11 @@ MerkleBlock.prototype.filterdTxsHash = function validMerkleTree() { |
|
|
throw new errors.MerkleBlock.InvalidMerkleTree(); |
|
|
throw new errors.MerkleBlock.InvalidMerkleTree(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// If there is only one hash the filter do not match any txs in the block
|
|
|
|
|
|
if(this.hashes.length === 1) { |
|
|
|
|
|
return []; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
var height = this._calcTreeHeight(); |
|
|
var height = this._calcTreeHeight(); |
|
|
var opts = { hashesUsed: 0, flagBitsUsed: 0 }; |
|
|
var opts = { hashesUsed: 0, flagBitsUsed: 0 }; |
|
|
var txs = this._traverseMerkleTree(height, 0, opts, true); |
|
|
var txs = this._traverseMerkleTree(height, 0, opts, true); |
|
|