Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some utxo script cannot be decoded by the library #123

Open
wind-shift opened this issue Aug 21, 2024 · 0 comments
Open

Some utxo script cannot be decoded by the library #123

wind-shift opened this issue Aug 21, 2024 · 0 comments

Comments

@wind-shift
Copy link

wind-shift commented Aug 21, 2024

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.

@wind-shift wind-shift changed the title Bunch of transactions between height 250000 and 300000 could not be decoded Some utxo script cannot be decoded by the library Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant