From 1454d578765bfa684491a7d90b42448706c29895 Mon Sep 17 00:00:00 2001 From: Lennart Date: Mon, 15 Jan 2024 09:03:26 +0100 Subject: [PATCH] Fix error when parsing incorrect spending script witness --- bitcoinlib/transactions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bitcoinlib/transactions.py b/bitcoinlib/transactions.py index 6894e70f..22ce2c4b 100644 --- a/bitcoinlib/transactions.py +++ b/bitcoinlib/transactions.py @@ -1498,7 +1498,9 @@ def parse_bytesio(cls, rawtx, strict=True, network=DEFAULT_NETWORK): inputs[n].script = script if not inputs[n].script else inputs[n].script + script inputs[n].keys = script.keys inputs[n].signatures = script.signatures - if script.script_types[0][:13] == 'p2sh_multisig' or script.script_types[0] =='signature_multisig': + if not script.signatures: + inputs[n].script_type = 'unknown' + elif script.script_types[0][:13] == 'p2sh_multisig' or script.script_types[0] =='signature_multisig': inputs[n].script_type = 'p2sh_multisig' inputs[n].redeemscript = inputs[n].witnesses[-1] elif script.script_types[0] == 'p2tr_unlock':