BIP352: Add support for Pay-to-Anchor (P2A) in get_pubkey_from_input #1707

pull Gudnessuche wants to merge 1 commits into bitcoin:master from Gudnessuche:patch-3 changing 1 files +5 −0
  1. Gudnessuche commented at 4:27 pm on November 30, 2024: contributor
    This commit adds a conditional statement to the get_pubkey_from_input function to handle Pay-to-Anchor (P2A) address types. The function now checks if the previous output is a P2A address type and extracts the public key from the anchor_script. This update ensures compatibility with the Bitcoin protocol for P2A address types and enhances the function’s versatility in processing various address types.
  2. Add support for Pay-to-Anchor (P2A) address type in get_pubkey_from_input function
    This commit adds a conditional statement to the get_pubkey_from_input function to handle Pay-to-Anchor (P2A) address types. The function now checks if the previous output is a P2A address type and extracts the public key from the anchor_script. This update ensures compatibility with the Bitcoin protocol for P2A address types and enhances the function's versatility in processing various address types.
    b999ac2d53
  3. jonatack renamed this:
    Add support for Pay-to-Anchor (P2A) address type in get_pubkey_from_i…
    BIP352: Add support for Pay-to-Anchor (P2A) in get_pubkey_from_input
    on Dec 5, 2024
  4. jonatack added the label Proposed BIP modification on Dec 5, 2024
  5. Gudnessuche commented at 9:25 am on December 5, 2024: contributor

    Thank you so much @jonatack for the appropriate name change.

    When merge?

  6. murchandamus added the label Pending acceptance on Dec 6, 2024
  7. murchandamus commented at 6:33 pm on December 6, 2024: contributor

    This needs review and sign-off from the BIP’s authors.

    cc: @josibake, @RubenSomsen

  8. in bip-0352/reference.py:82 in b999ac2d53
    77@@ -78,6 +78,11 @@ def get_pubkey_from_input(vin: VinInfo) -> ECPubKey:
    78             pubkey = ECPubKey().set(vin.prevout[2:])
    79             if (pubkey.valid) & (pubkey.compressed):
    80                 return pubkey
    81+    if is_p2a(vin.prevout): 
    82+        anchor_script = vin.scriptSig[1:] 
    


    theStack commented at 1:45 pm on December 9, 2024:
    scriptSig for segwit spends is always empty by consensus rules, so this line doesn’t make sense (see also https://bitcoin.stackexchange.com/questions/124615/is-the-scriptsig-spending-an-paytoanchor-output-expected-to-always-be-empty).

    Gudnessuche commented at 3:06 pm on December 9, 2024:
    Hmmm interesting, so it’s best to close this PR then?
  9. theStack commented at 1:46 pm on December 9, 2024: contributor

    The function now checks if the previous output is a P2A address type and extracts the public key from the anchor_script.

    Note that the P2A output type intentionally doesn’t involve keys, so there is nothing we could extract. I think there is no gain in handling this case explicitly, as we’d end up in the “nothing matched” (return ECPubKey()) case anyway, so it would be a no-op.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-21 16:10 UTC

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