From 4467e13743f21b0a1737151514fe2c417a6fb163 Mon Sep 17 00:00:00 2001 From: dev-bitSmiley <153714963+bitSmiley@users.noreply.github.com> Date: Wed, 24 Jul 2024 10:09:49 +0800 Subject: [PATCH] Update zetaclient/chains/bitcoin/tx_script.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- zetaclient/chains/bitcoin/tx_script.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/zetaclient/chains/bitcoin/tx_script.go b/zetaclient/chains/bitcoin/tx_script.go index 8c0ebf5ff4..3edb547d12 100644 --- a/zetaclient/chains/bitcoin/tx_script.go +++ b/zetaclient/chains/bitcoin/tx_script.go @@ -277,21 +277,18 @@ func DecodeTSSVout(vout btcjson.Vout, receiverExpected string, chain chains.Chai } func decodeInscriptionPayload(t *scriptTokenizer) ([]byte, error) { - if !t.Next() || t.Opcode() != txscript.OP_FALSE { + if (!t.Next() || t.Opcode() != txscript.OP_FALSE) { return nil, fmt.Errorf("OP_FALSE not found") } - if !t.Next() || t.Opcode() != txscript.OP_IF { + if (!t.Next() || t.Opcode() != txscript.OP_IF) { return nil, fmt.Errorf("OP_IF not found") } memo := make([]byte, 0) var next byte - for t.Next() { + for t.Next() && t.Opcode() != txscript.OP_ENDIF { next = t.Opcode() - if next == txscript.OP_ENDIF { - return memo, nil - } if next < txscript.OP_DATA_1 || next > txscript.OP_PUSHDATA4 { return nil, fmt.Errorf("expecting data push, found %d", next) }