Commit 2ae224b
committed
fix: make Transaction.from_raw() able to parse unsigned segwit tx
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 payload do not have any witness. 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 payload and by skipping the witnesses parsing
if that number is not greater than 4 (locktime field length).1 parent a93da8b commit 2ae224b
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
570 | | - | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
571 | 573 | | |
572 | | - | |
| 574 | + | |
573 | 575 | | |
574 | 576 | | |
575 | 577 | | |
| |||
0 commit comments