Skip to content

Some utxo script cannot be decoded by the library #123

Open
@wind-shift

Description

The library crashes for some transaction scripts

Here is the list of transactions concerned

2024-08-21 13:00:31 [warning  ] failed transaction parsing     debug=False dev=False env= error=BTClibValueError('Invalid pushdata length: 1443') height=251718 txid=77822fd6663c665104119cb7635352756dfc50da76a92d417ec1a12c518fad69
2024-08-21 13:00:31 [warning  ] failed transaction parsing     debug=False dev=False env= error=BTClibValueError('Not enough data for pushdata') height=265458 txid=ebc9fa1196a59e192352d76c0f6e73167046b9d37b8302b6bb6968dfd279b767
2024-08-21 13:00:31 [warning  ] failed transaction parsing     debug=False dev=False env= error=BTClibValueError('Invalid pushdata length: 983') height=268060 txid=d29c9c0e8e4d2a9790922af73f0b8d51f0bd4bb19940d9cf910ead8fbe85bc9b
2024-08-21 13:00:31 [warning  ] failed transaction parsing     debug=False dev=False env= error=BTClibValueError('Not enough data for pushdata') height=293906 txid=6f8a70aac37786b1f619d40250b8bca1a1f6da487146a7e81091f611068a23ef
2024-08-21 13:00:31 [warning  ] failed transaction parsing     debug=False dev=False env= error=BTClibValueError('Not enough data for pushdata') height=299571 txid=2ae22a393045a34ab634788117422607f092d061d39549c9b3e96259a5be0361

To Reproduce
Steps to reproduce the behavior:

Download the raw TX from the blockchain

bitcoin-cli getrawtransaction 2

You can get the script directly by doing

 bitcoin-cli getrawtransaction 77822fd6663c665104119cb7635352756dfc50da76a92d417ec1a12c518fad69 2 | jq '.vout[0]["scriptPubKey"]["hex"]'

Decode it using btclib

from btclib.script.script import Script
Script(bytes.fromhex(<hexscript>))

Expected behavior

Ideally the script decoding does not crash, indeed, if the transaction is supported by the blockchain and recorded, there is no reason btclib should not be able to parse the script.

version

The last published version at the time of this writing has been used.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions