diff --git a/code-ch13/tx.py b/code-ch13/tx.py index f6ab094b..9ba846a9 100644 --- a/code-ch13/tx.py +++ b/code-ch13/tx.py @@ -310,7 +310,7 @@ def verify_input(self, input_index): # the last cmd has to be the RedeemScript to trigger cmd = tx_in.script_sig.cmds[-1] # parse the RedeemScript - raw_redeem = int_to_little_endian(len(cmd), 1) + cmd + raw_redeem = encode_varint(len(cmd)) + cmd redeem_script = Script.parse(BytesIO(raw_redeem)) # the RedeemScript might be p2wpkh or p2wsh if redeem_script.is_p2wpkh_script_pubkey():