Skip to content

Commit

Permalink
use the tokenizer in the upgraded btcd package
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie committed Nov 1, 2024
1 parent 7bf67e1 commit 31b5f50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 165 deletions.
162 changes: 0 additions & 162 deletions zetaclient/chains/bitcoin/tokenizer.go

This file was deleted.

6 changes: 3 additions & 3 deletions zetaclient/chains/bitcoin/tx_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func DecodeOpReturnMemo(scriptHex string) ([]byte, bool, error) {
// OP_ENDIF
// There are no content-type or any other attributes, it's just raw bytes.
func DecodeScript(script []byte) ([]byte, bool, error) {
t := newScriptTokenizer(script)
t := txscript.MakeScriptTokenizer(0, script)

if err := checkInscriptionEnvelope(&t); err != nil {
return nil, false, errors.Wrap(err, "checkInscriptionEnvelope: unable to check the envelope")
Expand Down Expand Up @@ -306,7 +306,7 @@ func DecodeTSSVout(vout btcjson.Vout, receiverExpected string, chain chains.Chai
return receiverVout, amount, nil
}

func decodeInscriptionPayload(t *scriptTokenizer) ([]byte, error) {
func decodeInscriptionPayload(t *txscript.ScriptTokenizer) ([]byte, error) {
if !t.Next() || t.Opcode() != txscript.OP_FALSE {
return nil, fmt.Errorf("OP_FALSE not found")
}
Expand Down Expand Up @@ -335,7 +335,7 @@ func decodeInscriptionPayload(t *scriptTokenizer) ([]byte, error) {

// checkInscriptionEnvelope decodes the envelope for the script monitoring. The format is
// OP_PUSHBYTES_32 <32 bytes> OP_CHECKSIG <Content>
func checkInscriptionEnvelope(t *scriptTokenizer) error {
func checkInscriptionEnvelope(t *txscript.ScriptTokenizer) error {
if !t.Next() || t.Opcode() != txscript.OP_DATA_32 {
return fmt.Errorf("cannot obtain public key bytes op %d or err %s", t.Opcode(), t.Err())
}
Expand Down

0 comments on commit 31b5f50

Please sign in to comment.