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

Issue when parsing an unsigned segwit transaction with Transaction.from_raw() #101

Open
hcleonis opened this issue Jun 27, 2024 · 1 comment

Comments

@hcleonis
Copy link

Hi & thanks for your bitcoinutils package, very handy ! 👍 But I think I've spotted an issue.

Although Transaction.from_raw() is able to parse a signed or unsigned legacy tx, it is only able to correctly parse signed segwit txs because it assumes the presence of witnesses in the tx payload.
But unsigned segwit tx payloads do not have any witness field.

This PR proposes to fix that by checking the number of remaining bytes between the end of the last output and the end of the tx payload and by skipping the witnesses parsing if that number is not greater than 4 (i.e. last tx field i.e. locktime length).

@karask
Copy link
Owner

karask commented Jul 1, 2024

I will try to review the PR asap but I am away right now.

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

2 participants