Better errors for address use from wrong network #20809

issue instagibbs openend this issue on December 31, 2020
  1. instagibbs commented at 2:53 am on December 31, 2020: member

    I spent too long to figure out I was putting mainnet addresses to regtest node, errors weren’t helpful at getaddressinfo and validateaddress.

    Seems like a good first issue to augment the error messages when prefix/hrp don’t match current network.

  2. instagibbs added the label Bug on Dec 31, 2020
  3. instagibbs commented at 2:53 am on December 31, 2020: member
    hmm, not a bug, feature request.
  4. fanquake removed the label Bug on Dec 31, 2020
  5. fanquake added the label Feature on Dec 31, 2020
  6. MarcoFalke added the label good first issue on Dec 31, 2020
  7. MarcoFalke commented at 8:13 am on December 31, 2020: member

    Useful skills:

    • Bitcoin Core RPC interface and tests
    • bech32

    Want to work on this issue?

    For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.

  8. michaelfolkson commented at 3:12 pm on December 31, 2020: contributor

    This may be useful for whoever picks this up. https://bitcoin.stackexchange.com/questions/100508/can-you-break-down-what-data-is-encoded-into-a-bech32-address

    Should this be done for all addresses (including pre bech32) or just bech32?

  9. ghost commented at 8:54 pm on December 31, 2020: none

    @instagibbs I get these results for a ‘mainnet’ address used on testnet. What would you like to see in the new error messages? Address type mentioned in error based on prefix/hrp and network used?

  10. instagibbs commented at 10:55 pm on December 31, 2020: member

    Yeah ideally the message would have appended the detail “wrong network” or something like that.

    On Fri, Jan 1, 2021, 4:54 AM Prayank notifications@github.com wrote:

    getaddressinfo “bc1qjjrlgl28uqjtv0at2n3pfv3qtuvrm85vr0am5v”

    Invalid address (code -5)

    validateaddress “bc1qjjrlgl28uqjtv0at2n3pfv3qtuvrm85vr0am5v”

    { “isvalid”: false }

    @instagibbs https://github.com/instagibbs I get these results for a ‘mainnet’ address used on testnet. What would you like to see in the new error messages? Address type mentioned in error based on prefix/hrp?

    — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/issues/20809#issuecomment-753140435, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMAFU66AFVYVQNFVB2BVTTSXTQJFANCNFSM4VO6Z7BQ .

  11. eilx2 commented at 3:09 am on January 1, 2021: none

    Hello! I would be interested in working on this feature as it seems a good way for a first contribution. I’ve already managed to add an additional property called “error_msg” inside “validateaddress” in case the address is not valid and set it when the address is invalid.

    As for testing, I suppose I should add a functional test for this feature am I right?

  12. instagibbs commented at 12:10 pm on January 1, 2021: member
    @eilx2 Yes, check for assert_raises_rpc_error in the functional suite for inspiration on how to check these string returns.
  13. instagibbs commented at 12:11 pm on January 1, 2021: member
    When you open the PR feel free to tag me :+1:
  14. eilx2 referenced this in commit 7789374edf on Jan 3, 2021
  15. eilx2 referenced this in commit 5bcd90b9f7 on Jan 3, 2021
  16. eilx2 referenced this in commit daf5f66702 on Jan 3, 2021
  17. eilx2 referenced this in commit 36459e0e9d on Jan 3, 2021
  18. eilx2 referenced this in commit a913ee945c on Jan 3, 2021
  19. eilx2 referenced this in commit e9136878eb on Jan 3, 2021
  20. eilx2 referenced this in commit ef0a4f7083 on Jan 3, 2021
  21. eilx2 referenced this in commit 0f8f3344b9 on Jan 3, 2021
  22. eilx2 referenced this in commit f1c7aea502 on Jan 3, 2021
  23. eilx2 referenced this in commit 65ca93d515 on Jan 4, 2021
  24. eilx2 referenced this in commit 11de868a3d on Jan 4, 2021
  25. eilx2 referenced this in commit f58a4ed145 on Jan 4, 2021
  26. eilx2 referenced this in commit 8f0b64fb51 on Jan 24, 2021
  27. meshcollider referenced this in commit 4b15ffe991 on Jan 26, 2021
  28. remyers referenced this in commit d8591de9a3 on Jan 26, 2021
  29. jarolrod commented at 6:06 am on February 26, 2021: member
    This has been fixed by #20832 and can be closed.
  30. fanquake closed this on Feb 26, 2021

  31. luke-jr referenced this in commit 333927fa67 on Jun 27, 2021
  32. DrahtBot locked this on Aug 18, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-09-29 01:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me