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

Implement taproot specific script helpers #604

Closed
wants to merge 2 commits into from

Conversation

jrawsthorne
Copy link
Contributor

This change implements the script parts of #503. Will rebase with changes from #563 once it's merged

@sgeisler
Copy link
Contributor

There is also a dependency on #585 imo.

@@ -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())
Copy link
Collaborator

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

Copy link
Contributor Author

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()

Comment on lines +408 to +409
self.0[0] == opcodes::all::OP_PUSHNUM_1.into_u8() &&
self.0[1] == opcodes::all::OP_PUSHBYTES_32.into_u8()
Copy link
Collaborator

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

@dr-orlovsky dr-orlovsky added this to In process in Taproot Jun 20, 2021
@dr-orlovsky dr-orlovsky added this to the 0.28.0 milestone Sep 25, 2021
@dr-orlovsky
Copy link
Collaborator

Am I right that this PR was superseded by #585?

@apoelstra
Copy link
Member

ping @jrawsthorne

@dr-orlovsky dr-orlovsky mentioned this pull request Jan 6, 2022
20 tasks
@sanket1729
Copy link
Member

This is now done as a part of #696.

@sanket1729 sanket1729 closed this Jan 11, 2022
Taproot automation moved this from In process to Done Jan 11, 2022
@dr-orlovsky dr-orlovsky moved this from Done to Rejected in Taproot Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Taproot
Rejected
Development

Successfully merging this pull request may close these issues.

None yet

5 participants