[examples] Fix Miniscript variants issue in compiler example
miniscript has extended the `Miniscript` struct to be generic over a `ScriptContext`. This context is different for the `Sh` variant (`Legacy`) than for the `Wsh` and `ShWsh` variants (`Segwitv0`). Therefore, Rust is not happy with the single `compiled` variable if it is used as an argument for all three variants.
This commit is contained in:
parent
a581457ba8
commit
462d413b02
@ -63,12 +63,11 @@ fn main() {
|
|||||||
info!("Compiling policy: {}", policy_str);
|
info!("Compiling policy: {}", policy_str);
|
||||||
|
|
||||||
let policy = Concrete::<String>::from_str(&policy_str).unwrap();
|
let policy = Concrete::<String>::from_str(&policy_str).unwrap();
|
||||||
let compiled = policy.compile().unwrap();
|
|
||||||
|
|
||||||
let descriptor = match matches.value_of("TYPE").unwrap() {
|
let descriptor = match matches.value_of("TYPE").unwrap() {
|
||||||
"sh" => Descriptor::Sh(compiled),
|
"sh" => Descriptor::Sh(policy.compile().unwrap()),
|
||||||
"wsh" => Descriptor::Wsh(compiled),
|
"wsh" => Descriptor::Wsh(policy.compile().unwrap()),
|
||||||
"sh-wsh" => Descriptor::ShWsh(compiled),
|
"sh-wsh" => Descriptor::ShWsh(policy.compile().unwrap()),
|
||||||
_ => panic!("Invalid type"),
|
_ => panic!("Invalid type"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user