rpc: clarify wrong-network address errors #35075

pull takeshikurosawaa wants to merge 2 commits into bitcoin:master from takeshikurosawaa:wrong-network-address-errors changing 6 files +76 −4
  1. takeshikurosawaa commented at 7:35 PM on April 14, 2026: none

    Fixes #26290.

    This updates RPC address validation to return a more specific error when an address is valid for a different network than the one the node is running on.

    Changes:

    • add a shared helper to detect different-network addresses
    • use it in generatetoaddress
    • use it in the raw-address fallback path of generateblock
    • use it for changeAddress / change_address in walletcreatefundedpsbt
    • keep existing generic errors for malformed addresses

    Tests:

    • test/functional/rpc_generate.py
    • test/functional/rpc_psbt.py
  2. fix(rpc): Clarify wrong-network address errors
    Detect when an otherwise valid address belongs to a different network\nand surface a specific error for generatetoaddress, generateblock, and\nwalletcreatefundedpsbt change addresses. Keep the existing generic\nmessages for malformed inputs.\n\nAdd functional coverage for uniquely identifiable and ambiguous wrong-\nnetwork addresses so the new RPC behavior stays locked in.\n\nFixes #26290
    5bfca5e4ff
  3. DrahtBot added the label RPC/REST/ZMQ on Apr 14, 2026
  4. DrahtBot commented at 7:36 PM on April 14, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept NACK naiyoma

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34950 (rpc: migrate generatetoaddress params to self.Arg for consistency by defenwycke)
    • #32468 (rpc: generateblock to allow multiple outputs by polespinasa)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. test(rpc): Use named locktime args in psbt tests
    Use named arguments for the new wrong-network change address checks in\nrpc_psbt.py to address the PR lint nit about positional integral\nliterals.\n\nKeep behavior unchanged while making the test calls clearer to review.
    776761dc7e
  6. naiyoma commented at 12:18 PM on April 15, 2026: contributor

    Concept NACK.

    From a quick look at #27260(https://github.com/bitcoin/bitcoin/pull/27260), it seems to sufficiently address this issue. If you prefer a different approach, it would be helpful to explain why it’s better.

  7. takeshikurosawaa commented at 12:44 PM on April 15, 2026: none

    Thanks, that's helpful. I took a closer look at #27260 and agree this would duplicate that effort, so I'll close this one.

  8. takeshikurosawaa closed this on Apr 15, 2026


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: 2026-04-21 09:12 UTC

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