rust-bitcoin / rust-bech32

Bech32 format encoding and decoding
MIT License
94 stars 49 forks source link

More error correction preparation (upgrades to `Field`, `Polynomial`, `InvalidResidueError` and others) #202

Closed apoelstra closed 1 month ago

apoelstra commented 1 month ago

This PR has a fairly large diff but the commits should be self-contained and much of the diff consists of comments. In particular this introduces a new type FieldVec to back Polynomial, which strives to provide a sensible API even in a no-alloc case:

The threshold for "large" is currently set at "bigger than bech32", but it is easy to change this and even easy to add a feature-gate.

I believe this completes all the changes to the traits needed for error correction, and the next PR can just implement correction.

apoelstra commented 1 month ago

CI failed because I had a doccomment referring to a field of Checksum that didn't yet exist. Backported the commit that introduced it.

But now this PR is way too big :). Gonna close it and split it.