-
Notifications
You must be signed in to change notification settings - Fork 139
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
Tr compiler #460
base: master
Are you sure you want to change the base?
Tr compiler #460
Conversation
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.
Did not review the compiler yet.
@@ -12,7 +12,7 @@ edition = "2018" | |||
|
|||
[features] | |||
default = ["std"] | |||
std = ["bitcoin/std", "bitcoin/secp-recovery"] | |||
std = ["bitcoin/std", "bitcoin/secp-recovery", "secp256k1-zkp"] |
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.
Unrelated to this. But I don't think we should be using secp recovery.
src/miniscript/context.rs
Outdated
Terminal::MultiA(_, ref keys) => { | ||
if keys | ||
.iter() | ||
.all(|keyexpr| keyexpr.iter().any(|pk| pk.is_uncompressed())) |
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.
This should be any
instead of all
right?
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.
Yes, this should be any. I have fixed it now.
@@ -125,8 +126,16 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> { | |||
/// `miniscript.iter_pubkeys().collect()`. | |||
pub fn get_leapk(&self) -> Vec<Pk> { | |||
match self.node { | |||
Terminal::PkK(ref key) | Terminal::PkH(ref key) => vec![key.clone()], | |||
Terminal::Multi(_, ref keys) | Terminal::MultiA(_, ref keys) => keys.clone(), | |||
Terminal::PkK(ref key) => key.iter().map(|pk| pk.clone()).collect(), |
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.
I have updated the iterator file at: https://github.com/sanket1729/rust-miniscript/tree/pr460
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 can cherry pick the commits and add them here
KeyExpr::<Pk>::SingleKey(ref pk) => pk.to_public_key().to_bytes(), | ||
KeyExpr::<Pk>::MuSig(_) => { | ||
let agg_key = self.key_agg(); | ||
agg_key.to_public_key().to_bytes() |
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 should not need the .to_public_key here
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.
Ok, I have removed to_public_key()
and used the serialize()
function.
)), | ||
None => Ok(Policy::KeyHash(self.internal_key.to_pubkeyhash())), | ||
// None => Ok(Policy::KeyHash(self.internal_key.to_pubkeyhash())), |
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.
Remove, commented line here
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.
Removed.
|
||
// address for the descriptor (bc1...) | ||
let address = real_desc.address(Network::Bitcoin).unwrap(); | ||
println!("The address is {}", address); |
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.
Also print what the internal key is
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.
Done.
} | ||
ind += 1; |
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 thrilled with this part. Ideally, we should be able to get the complete Tree and parse the script spend and key spend nicely. This hack worked nicely for key spend when there was a single key and now it's an even ugly hack. I will fixup the tree decoding later
51263b4
to
32173ad
Compare
32173ad
to
0835052
Compare
What's the latest status of this? Gonna be in 9.0? :) |
This is me wanting to figure out how to expose this as an experimental feature. |
Adds the logic for converting fragments to Musig and also updates the internal key extraction logic to take benefit of Musig.