wallet: extract PubKey from P2PK script with Solver #16753

pull theStack wants to merge 1 commits into bitcoin:master from theStack:extractpubkey_with_solver changing 1 files +3 −12
  1. theStack commented at 11:40 AM on August 29, 2019: member

    The function ExtractPubKey() checks if a given script matches the P2PK pattern (<PubKey> OP_CHECKSIG), extracts the PubKey and additionally checks if it is cryptographically valid (full validation with ECC library via CPubKey::IsFullyValid()).

    Currently this is done manually in the following order:

    1. check if first script OP is data push with valid PubKey length (first part of pattern match), extract PubKey
    2. create CPubKey object with extracted PubKey
    3. fully validate public key
    4. check if last script OP is OP_CHECKSIG (second part of pattern match)

    Using Solver, the pattern matching and PubKey extraction can be done via a single step, leading to the following simplified order with shorter code:

    1. check if given script matches P2PK pattern with Solver (also contains valid PubKey length check), extracts Pubkey
    2. create CPubKey object with extracted Pubkey
    3. fully validate public key
  2. wallet: extract PubKey from P2PK script with Solver
    The function ExtractPubKey() checks if a given script matches the P2PK pattern
    (<PubKey> OP_CHECKSIG), extracts the PubKey and additionally checks if it is
    cryptographically valid (full validation with ECC library via .IsFullyValid()).
    
    Currently this is done manually in the following order:
        1) check if first script OP is data push with valid PubKey length
           (first part of pattern match), extract PubKey
        2) create CPubKey object with extracted PubKey
        3) fully validate public key
        4) check if last script OP is OP_CHECKSIG
           (second part of pattern match)
    
    Using Solver, the pattern matching and PubKey extraction can be done via a
    single step, leading to the following simplified order with shorter code:
        1) check if given script matches P2PK pattern with Solver
           (also contains valid PubKey length check), extracts Pubkey
        2) create CPubKey object with extracted Pubkey
        3) fully validate public key
    798a589aff
  3. fanquake added the label Wallet on Aug 29, 2019
  4. fanquake requested review from achow101 on Aug 29, 2019
  5. DrahtBot commented at 12:38 PM on August 29, 2019: member

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #16341 (Introduce ScriptPubKeyMan interface and use it for key and script management (aka wallet boxes) by achow101)

    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.

  6. instagibbs commented at 3:12 PM on August 29, 2019: member

    utACK https://github.com/bitcoin/bitcoin/pull/16753/commits/798a589aff64b83a0844688a661f4bd987c3340c

    Stretch goal would be to include a unit test for this, since there are none, but not a requirement.

  7. theStack commented at 4:56 PM on August 29, 2019: member

    utACK 798a589

    Stretch goal would be to include a unit test for this, since there are none, but not a requirement.

    Sounds reasonable, will work on that.

  8. achow101 approved
  9. achow101 commented at 6:04 PM on August 29, 2019: member

    Code Review ACK 798a589aff64b83a0844688a661f4bd987c3340c

  10. sipa commented at 12:55 AM on August 30, 2019: member

    ACK 798a589aff64b83a0844688a661f4bd987c3340c

  11. fanquake referenced this in commit a8ecd0dada on Aug 30, 2019
  12. fanquake merged this on Aug 30, 2019
  13. fanquake closed this on Aug 30, 2019

  14. meshcollider commented at 1:28 AM on August 30, 2019: contributor

    post merge utACK 798a589aff64b83a0844688a661f4bd987c3340c

  15. sidhujag referenced this in commit 4fd2217abd on Aug 30, 2019
  16. kittywhiskers referenced this in commit 4ab4e06c89 on Dec 4, 2021
  17. kittywhiskers referenced this in commit 97de1bd4ee on Dec 8, 2021
  18. kittywhiskers referenced this in commit 96cface703 on Dec 8, 2021
  19. kittywhiskers referenced this in commit 4413859882 on Dec 12, 2021
  20. kittywhiskers referenced this in commit 1782cb8735 on Dec 12, 2021
  21. kittywhiskers referenced this in commit 5eab643679 on Dec 12, 2021
  22. kittywhiskers referenced this in commit d06c50c6ff on Dec 13, 2021
  23. kittywhiskers referenced this in commit 97ad82cd68 on Dec 13, 2021
  24. kittywhiskers referenced this in commit 1ab8f36783 on Dec 13, 2021
  25. DrahtBot locked this on Dec 16, 2021
  26. theStack deleted the branch on Dec 26, 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: 2026-04-14 21:14 UTC

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