karask / python-bitcoin-utils

Library to interact with the Bitcoin network. Ideal for low-level learning and experimenting.
MIT License
262 stars 99 forks source link

Bug in witness length encoding #98

Closed ramonamela closed 1 month ago

ramonamela commented 1 month ago

When encoding the witness length, an hex representation is used instead of compactSize integer. This bug only affects transactions with more than 127 elements so length becomes 0x80. In this case, the correct encoding is 0x0080 instead of 0x80.

The fix is pretty straight forward so I already opened a PR:

https://github.com/karask/python-bitcoin-utils/pull/97