IntersectMBO / bech32

Haskell implementation of the Bech32 address format (BIP 0173).
Apache License 2.0
47 stars 13 forks source link

Export `dataPartFromWords` and `dataPartToWords` in `Codec.Binary.Bech32` in order to access segwit version number. #3

Closed roconnor-blockstream closed 4 years ago

roconnor-blockstream commented 4 years ago

The segwit address format defined in BIP-173 states that the first character of the DataPart encodes the witness version number. However the API given in Codec.Binary.Bech32 doesn't provide any means of either setting or extracting the first character from the DataPart.

I've resorted to using the dataPartFromWords and dataPartToWords from the Codec.Binary.Bech32.Internal module to gain access to the witness version number.

jonathanknowles commented 4 years ago

Hi @roconnor-blockstream,

Many thanks for reporting this. :+1:

Indeed, there are a few gaps in the public interface of Codec.Binary.Bech32, and the omission of Word5 is one of these gaps.

I've added this to our internal list of improvement tasks, and will let you know once we've added it.

Thanks again!

jonathanknowles commented 4 years ago

Hi @roconnor-blockstream

We've just released a new version (1.0.1) on Hackage which includes a fix to this issue.

Thanks again for raising this issue! Feel free to let us know if you have any further suggestions for improvements.