]> Untitled Git - bdk-cli/commitdiff
[wallet] Add an option to change the assumed current height
authorAlekos Filini <alekos.filini@gmail.com>
Wed, 6 May 2020 15:17:14 +0000 (17:17 +0200)
committerAlekos Filini <alekos.filini@gmail.com>
Wed, 6 May 2020 15:17:14 +0000 (17:17 +0200)
examples/repl.rs

index 66598514d37f6f1caaf59dbb26bda71d2de0d27f..13ee095120b1831de8cdba31f629e789b08fd4c1 100644 (file)
@@ -161,6 +161,15 @@ fn main() {
                         .takes_value(true)
                         .number_of_values(1)
                         .required(true),
+                )
+                .arg(
+                    Arg::with_name("assume_height")
+                        .long("assume_height")
+                        .value_name("HEIGHT")
+                        .help("Assume the blockchain has reached a specific height. This affects the transaction finalization, if there are timelocks in the descriptor")
+                        .takes_value(true)
+                        .number_of_values(1)
+                        .required(false),
                 ))
         .subcommand(
             SubCommand::with_name("broadcast")
@@ -322,7 +331,10 @@ fn main() {
         } else if let Some(sub_matches) = matches.subcommand_matches("sign") {
             let psbt = base64::decode(sub_matches.value_of("psbt").unwrap()).unwrap();
             let psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap();
-            let (psbt, finalized) = wallet.sign(psbt).unwrap();
+            let assume_height = sub_matches
+                .value_of("assume_height")
+                .and_then(|s| Some(s.parse().unwrap()));
+            let (psbt, finalized) = wallet.sign(psbt, assume_height).unwrap();
 
             println!("PSBT: {}", base64::encode(&serialize(&psbt)));
             println!("Finalized: {}", finalized);