gcs/builder: an empty filter has a zero-hash
This commit is contained in:
parent
65172ea539
commit
5a770ec85e
1 changed files with 5 additions and 0 deletions
|
@ -371,6 +371,11 @@ func BuildExtFilter(block *wire.MsgBlock) (*gcs.Filter, error) {
|
||||||
|
|
||||||
// GetFilterHash returns the double-SHA256 of the filter.
|
// GetFilterHash returns the double-SHA256 of the filter.
|
||||||
func GetFilterHash(filter *gcs.Filter) chainhash.Hash {
|
func GetFilterHash(filter *gcs.Filter) chainhash.Hash {
|
||||||
|
var zero chainhash.Hash
|
||||||
|
if filter == nil {
|
||||||
|
return zero
|
||||||
|
}
|
||||||
|
|
||||||
hash1 := chainhash.HashH(filter.NBytes())
|
hash1 := chainhash.HashH(filter.NBytes())
|
||||||
return chainhash.HashH(hash1[:])
|
return chainhash.HashH(hash1[:])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue