wallet: treat P2TR address with invalid x-only pubkey as invalid #24121

pull w0xlt wants to merge 1 commits into bitcoin:master from w0xlt:validate_P2TR_invalid_pk changing 3 files +18 −2
  1. w0xlt commented at 11:38 AM on January 21, 2022: contributor

    As suggested in #24106#issue-1108820339, this PR changes DecodeDestination to consider bech32m (segwit v1) addresses as invalid if the encoded x-only pubkey is not on the curve. This prevents users from inadvertently burning funds.

    This PR must not change policy or consensus rules and keep the current approach, where the user cannot send funds to invalid addresses.

  2. MarcoFalke commented at 12:06 PM on January 21, 2022: member

    NACK. While this doesn't change policy, practically this is no different than #24106 for batch withdrawals. With #24106 the batch withdrawal will be rejected by the network, or by the local mempool (if it is running #24106). With this pull the batch withdrawal will be rejected by the wallet.

    This is a problem that needs to be solved when creating the address (or at least before handing it out).

  3. DrahtBot added the label Utils/log/libs on Jan 21, 2022
  4. DrahtBot added the label Wallet on Jan 21, 2022
  5. w0xlt commented at 12:46 PM on January 21, 2022: contributor

    With this pull the batch withdrawal will be rejected by the wallet.

    This already happens for invalid addresses. DecodeDestination() returns CNoDestination for any invalid addresses. This PR just adds one more validation.

  6. sipa commented at 3:50 PM on January 21, 2022: member

    @w0xlt Which addresses are valid should be well-specified and consistent across the network. Yes, some addresses are invalid - obviously - and those are well-specified I think in BIP173 and BIP350. That set can certainly change, and may need to be changed from time to time, but it's not something we can unilaterally change in the Bitcoin Core software without discussions across the ecosystem. Doing so will cause stuck payments (less so than if it's done as a relay policy, but still any infrastructure depending on Bitcoin Core will see things change from under them).

    Concept NACK on doing anything more than a warning, unless first preceded by a wide discussion about this.

  7. wallet: treat P2TR address with invalid x-only pubkey as invalid
    Treat bech32m (segwit v1) addresses as invalid if the encoded x-only
    pubkey is not on the curve.
    This prevents users from inadvertently burning funds.
    This commit must not change policy or consensus rules.
    15d4873521
  8. w0xlt force-pushed on Jan 21, 2022
  9. luke-jr commented at 7:27 PM on January 29, 2022: member

    (It might make sense to treat these as OP_RETURNs and not store the UTXOs? But not sure it's worth the additional code/complexity...)

  10. MarcoFalke commented at 9:34 AM on August 1, 2022: member

    Can this be closed?

  11. w0xlt closed this on Aug 1, 2022

  12. w0xlt deleted the branch on Aug 1, 2022
  13. bitcoin locked this on Aug 1, 2023

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-13 15:14 UTC

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