From 462d413b02ec05b401d25dd7acb3237fcb522b4a Mon Sep 17 00:00:00 2001 From: Dominik Spicher Date: Fri, 7 Aug 2020 16:08:23 +0200 Subject: [PATCH] [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. --- examples/compiler.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/compiler.rs b/examples/compiler.rs index 09cad948..04558fba 100644 --- a/examples/compiler.rs +++ b/examples/compiler.rs @@ -63,12 +63,11 @@ fn main() { info!("Compiling policy: {}", policy_str); let policy = Concrete::::from_str(&policy_str).unwrap(); - let compiled = policy.compile().unwrap(); let descriptor = match matches.value_of("TYPE").unwrap() { - "sh" => Descriptor::Sh(compiled), - "wsh" => Descriptor::Wsh(compiled), - "sh-wsh" => Descriptor::ShWsh(compiled), + "sh" => Descriptor::Sh(policy.compile().unwrap()), + "wsh" => Descriptor::Wsh(policy.compile().unwrap()), + "sh-wsh" => Descriptor::ShWsh(policy.compile().unwrap()), _ => panic!("Invalid type"), };