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

Exception when wrong network #1

Open
delchiv opened this issue Apr 30, 2018 · 1 comment
Open

Exception when wrong network #1

delchiv opened this issue Apr 30, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@delchiv
Copy link

delchiv commented Apr 30, 2018

Hi, thanks for useful library.

One issue, when checking address with wrong currency, we have exception due to strong typing. Here:

    @property
    def network(self):
        """Return network derived from network version bytes."""
        abytes = base58check.b58decode(
            self.request.address, **self.request.extras)

        nbyte = abytes[0]
        for name, networks in self.request.currency.networks.items():
            if nbyte in networks:
                return name

In case of wrong networks you return None, but expecting string. So we have valid=False and exception.

P.S. more currency structures you can find here: https://github.com/ognus/wallet-address-validator/blob/master/src/currencies.js

@tarceri
Copy link
Contributor

tarceri commented Feb 19, 2021

Yeah the function should end with:
return ''

To return an empty network string for when the address is invalid. Seems almost all bug reports are about this same issue.

sourcery-ai bot pushed a commit that referenced this issue May 26, 2022
Add support for litecoins testnets p2sh new Q-address
@joeblackwaslike joeblackwaslike added the bug Something isn't working label Oct 17, 2022
@joeblackwaslike joeblackwaslike self-assigned this Oct 17, 2022
This was referenced Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants