filteredTxsHash method
Implementation
List<String> filteredTxsHash() {
// Can't have more hashes than numTransactions
if (hashes!.length > numTransactions!) {
throw MerkleTreeException('Invalid merkle tree - more hashes than transactions');
}
// Can't have more flag bits than num hashes
if (flags!.length * 8 < hashes!.length) {
throw MerkleTreeException('Invalid merkle tree - more flag bits than hashes');
}
// If there is only one hash the filter do not match any txs in the block
if (hashes!.length == 1) {
return [];
};
var height = _calcTreeHeight();
var hashesUsed = 0, flagBitsUsed = 0;
var result = _traverseMerkleTree(height, 0, hashesUsed: hashesUsed, flagBitsUsed: flagBitsUsed, checkForTxs: true);
if (result!['hashesUsed'] != hashes!.length) {
throw MerkleTreeException('Invalid merkle tree');
}
return result['transactions'];
}