Skip to content

Commit

Permalink
btcutl/gcs: update filter logic to use new DoubleHashRaw
Browse files Browse the repository at this point in the history
  • Loading branch information
Roasbeef committed Dec 15, 2023
1 parent e22513c commit 7745cbb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions btcutil/gcs/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package builder
import (
"crypto/rand"
"fmt"
"io"
"math"

"github.com/btcsuite/btcd/btcutil/gcs"
Expand Down Expand Up @@ -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
Expand All @@ -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
}

0 comments on commit 7745cbb

Please sign in to comment.