From 5a770ec85e1abda3783a43bdd7b21cd368811356 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 27 Apr 2017 21:47:56 -0700 Subject: [PATCH] gcs/builder: an empty filter has a zero-hash --- gcs/builder/builder.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcs/builder/builder.go b/gcs/builder/builder.go index 5235d5a..b72e14a 100644 --- a/gcs/builder/builder.go +++ b/gcs/builder/builder.go @@ -371,6 +371,11 @@ func BuildExtFilter(block *wire.MsgBlock) (*gcs.Filter, error) { // GetFilterHash returns the double-SHA256 of the filter. func GetFilterHash(filter *gcs.Filter) chainhash.Hash { + var zero chainhash.Hash + if filter == nil { + return zero + } + hash1 := chainhash.HashH(filter.NBytes()) return chainhash.HashH(hash1[:]) }