Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Bech32 Encoding #1798

Open
Fardinak opened this issue Sep 28, 2020 · 1 comment
Open

Invalid Bech32 Encoding #1798

Fardinak opened this issue Sep 28, 2020 · 1 comment

Comments

@Fardinak
Copy link

Here's what I did:

  • Configured and started btcd and btcwallet daemons (SimNet)
  • Generated a bunch of addresses using btcctl
  • Used the btcd/rpcclient library to fetch the addresses by invoking *Client.GetAddressesByAccount(account)

The error:

string not all lowercase or all uppercase

Here is the malformed address: Sb1Hqfcey8tHkBYvpjQ8Nch2zsREaHcgjD

As you can see, the prefix matches SimNet's Bech32 HRP but the address is mixed case which causes the error. I'm not well equipped to check if the address is otherwise Bech32 compliant or not; but since I could only find this one instance between 10K generated addresses, I'm guessing this is just random?! It does however break the API.

How could we make the SegWit address check in the DecodeAddress method better? Would it be feasible to also add a case check to DecodeAddress?

@Roasbeef Roasbeef transferred this issue from btcsuite/btcutil Jan 29, 2022
@Roasbeef
Copy link
Member

Transferred from the old btcutil repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants