mirror of
https://github.com/btcsuite/btcd.git
synced 2026-08-13 12:32:51 +02:00
BIP-350 requires that segregated witness outputs of version 1 through 16 use the bech32m checksum, while only version 0 uses bech32. decodeSegWitAddress only special-cased versions 0 and 1, so a witness program with version 2-16 encoded using the legacy bech32 checksum decoded successfully, in violation of the spec and contrary to the BIP-350 reference decoder (which rejects any non-zero witness version that is not bech32m). Generalize the version 1 check to cover all versions >= 1, matching the reference decode() function. Add the relevant BIP-350 INVALID_ADDRESS vectors (v2 and v16 encoded with bech32) as a regression test; they decoded successfully before this change and are now rejected. Signed-off-by: Lrifton92 <Lrifton92@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| base58 | ||
| bech32 | ||
| address.go | ||
| address_test.go | ||
| bip350_diff_test.go | ||
| go.mod | ||
| go.sum | ||
| hash160.go | ||
| internal_test.go | ||
| p2a_address_test.go | ||