Skip to content

Commit

Permalink
replace hardcoded number with btcd defined constant
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie committed Nov 1, 2024
1 parent abb90d3 commit 95f8230
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zetaclient/chains/bitcoin/observer/witness.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/btcsuite/btcd/btcjson"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/txscript"
"github.com/pkg/errors"
"github.com/rs/zerolog"

Expand Down Expand Up @@ -104,7 +105,7 @@ func ParseScriptFromWitness(witness []string, logger zerolog.Logger) []byte {
// If there are at least two witness elements, and the first byte of
// the last element is 0x50, this last element is called annex a
// and is removed from the witness stack.
if length >= 2 && len(lastElement) > 0 && lastElement[0] == 0x50 {
if length >= 2 && len(lastElement) > 0 && lastElement[0] == txscript.TaprootAnnexTag {
// account for the extra item removed from the end
witness = witness[:length-1]
}
Expand Down

0 comments on commit 95f8230

Please sign in to comment.