Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add taproot checks to Address::from_script #1029

Closed
wants to merge 4 commits into from

Commits on May 31, 2022

  1. Configuration menu
    Copy the full SHA
    6c10d77 View commit details
    Browse the repository at this point in the history
  2. Add taproot script check to Address::from_script

    Recently we added segwit v0 script checks to the `Address::from_script`
    method, following the principle that we want to provide some safety for
    users in the 'main' rust-bitcoin API.
    
    At the time we did not add taproot checks because doing so broke one of
    the test vector unit tests. Turns out the unit test was doing
    roundtripping of an address -> scipt_pubkey() -> address which is not
    strictly required by BIP-350 (where the test vector comes from).
    
    Modify the unit test by adding a boolean flag indicating whether the
    address should roundtrip and only roundtrip test such addresses.
    
    Add taproot script validity check to the `Address::from_script` method.
    tcharding committed May 31, 2022
    Configuration menu
    Copy the full SHA
    31b04ed View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2022

  1. Add Returns section to from_script docs

    We recently decided to provide additional safety for users by not
    creating addresses from certain invalid scripts.
    
    Add rustdocs describing the return value and the safety guarantees we
    are explicitly providing so as not to surprise users.
    
    (See GitHub issue rust-bitcoin#955 for more context.)
    tcharding committed Jun 1, 2022
    Configuration menu
    Copy the full SHA
    a707a0d View commit details
    Browse the repository at this point in the history
  2. Add unit test for invalid taproot script

    Creating an address from an invalid taproot script should fail. Add a
    unit test to verify it does.
    tcharding committed Jun 1, 2022
    Configuration menu
    Copy the full SHA
    1c3ab49 View commit details
    Browse the repository at this point in the history