-
Notifications
You must be signed in to change notification settings - Fork 620
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
Implement taproot specific script helpers #604
Conversation
e9e47be
to
c805ff4
Compare
There is also a dependency on #585 imo. |
src/blockdata/script.rs
Outdated
@@ -271,6 +272,11 @@ impl Script { | |||
Script::new_witness_program(::bech32::u5::try_from_u8(0).unwrap(), &script_hash.to_vec()) | |||
} | |||
|
|||
/// Generates P2TR-type of scriptPubkey | |||
pub fn new_v1_tr(public_key: &schnorr::PublicKey) -> Script { | |||
Script::new_witness_program(::bech32::u5::try_from_u8(1).unwrap(), &public_key.serialize().to_vec()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why you are calling allocating to_vec()
function just to take the reference after.
Also will need to get rid out of u5
-caused unwrap
, but that requires #563 merge as you said, with its WitnessVersion
type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I've removed that and added a commit to do the same for new_v0_wpkh() and new_v0_wsh()
self.0[0] == opcodes::all::OP_PUSHNUM_1.into_u8() && | ||
self.0[1] == opcodes::all::OP_PUSHBYTES_32.into_u8() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to the PR, but just a thought that we probably need to refactor all these opcode-based version guessing via WitnessVersion API
c805ff4
to
ca90a6c
Compare
Am I right that this PR was superseded by #585? |
ping @jrawsthorne |
This is now done as a part of #696. |
This change implements the script parts of #503. Will rebase with changes from #563 once it's merged