From 7745cbb679dc9057e31ae625004fdc3c46aa327a Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 15 Dec 2023 14:25:11 -0800 Subject: [PATCH] btcutl/gcs: update filter logic to use new DoubleHashRaw --- btcutil/gcs/builder/builder.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/btcutil/gcs/builder/builder.go b/btcutil/gcs/builder/builder.go index af05f819a5..3a85ad0519 100644 --- a/btcutil/gcs/builder/builder.go +++ b/btcutil/gcs/builder/builder.go @@ -8,6 +8,7 @@ package builder import ( "crypto/rand" "fmt" + "io" "math" "github.com/btcsuite/btcd/btcutil/gcs" @@ -348,7 +349,10 @@ func GetFilterHash(filter *gcs.Filter) (chainhash.Hash, error) { return chainhash.Hash{}, err } - return chainhash.DoubleHashH(filterData), nil + return chainhash.DoubleHashRaw(func(w io.Writer) error { + _, err := w.Write(filterData) + return err + }), nil } // MakeHeaderForFilter makes a filter chain header for a filter, given the @@ -367,5 +371,8 @@ func MakeHeaderForFilter(filter *gcs.Filter, prevHeader chainhash.Hash) (chainha // The final filter hash is the double-sha256 of the hash computed // above. - return chainhash.DoubleHashH(filterTip), nil + return chainhash.DoubleHashRaw(func(w io.Writer) error { + _, err := w.Write(filterTip) + return err + }), nil }