From 468d2a0a3b349adb12564847d50a5e5b30c9df3e Mon Sep 17 00:00:00 2001 From: Daniela Brozzoni Date: Mon, 26 Jun 2023 12:18:15 +0200 Subject: [PATCH] Update tmp_plan to rust-bitcoin 0.30.0 --- nursery/tmp_plan/src/lib.rs | 39 ++++++++++++++++------------ nursery/tmp_plan/src/plan_impls.rs | 12 +++++---- nursery/tmp_plan/src/requirements.rs | 31 +++++++++++++++------- nursery/tmp_plan/src/template.rs | 2 +- 4 files changed, 52 insertions(+), 32 deletions(-) diff --git a/nursery/tmp_plan/src/lib.rs b/nursery/tmp_plan/src/lib.rs index d7248d82..dce19014 100644 --- a/nursery/tmp_plan/src/lib.rs +++ b/nursery/tmp_plan/src/lib.rs @@ -16,15 +16,15 @@ //! witness/script_sig for the input. use bdk_chain::{bitcoin, collections::*, miniscript}; use bitcoin::{ - blockdata::{locktime::LockTime, transaction::Sequence}, + absolute, + address::WitnessVersion, + bip32::{DerivationPath, Fingerprint, KeySource}, + blockdata::transaction::Sequence, + ecdsa, hashes::{hash160, ripemd160, sha256}, secp256k1::Secp256k1, - util::{ - address::WitnessVersion, - bip32::{DerivationPath, Fingerprint, KeySource}, - taproot::{LeafVersion, TapBranchHash, TapLeafHash}, - }, - EcdsaSig, SchnorrSig, Script, TxIn, Witness, + taproot::{self, LeafVersion, TapLeafHash}, + ScriptBuf, TxIn, Witness, }; use miniscript::{ descriptor::{InnerXKey, Tr}, @@ -46,7 +46,7 @@ use template::TemplateItem; enum TrSpend { KeySpend, LeafSpend { - script: Script, + script: ScriptBuf, leaf_version: LeafVersion, }, } @@ -55,7 +55,7 @@ enum TrSpend { enum Target { Legacy, Segwitv0 { - script_code: Script, + script_code: ScriptBuf, }, Segwitv1 { tr: Tr, @@ -72,7 +72,7 @@ impl Target {} pub struct Plan { template: Vec>, target: Target, - set_locktime: Option, + set_locktime: Option, set_sequence: Option, } @@ -86,9 +86,9 @@ impl Default for Target { /// Signatures and hash pre-images that can be used to complete a plan. pub struct SatisfactionMaterial { /// Schnorr signautres under their keys - pub schnorr_sigs: BTreeMap, + pub schnorr_sigs: BTreeMap, /// ECDSA signatures under their keys - pub ecdsa_sigs: BTreeMap, + pub ecdsa_sigs: BTreeMap, /// SHA256 pre-images under their images pub sha256_preimages: BTreeMap>, /// hash160 pre-images under their images @@ -201,7 +201,7 @@ where .. } => PlanState::Complete { final_script_sig: None, - final_script_witness: Some(Witness::from_vec(witness)), + final_script_witness: Some(Witness::from(witness)), }, Target::Segwitv1 { tr, @@ -220,7 +220,7 @@ where PlanState::Complete { final_script_sig: None, - final_script_witness: Some(Witness::from_vec(witness)), + final_script_witness: Some(Witness::from(witness)), } } } @@ -306,7 +306,7 @@ where } /// The minimum required locktime height or time on the transaction using the plan. - pub fn required_locktime(&self) -> Option { + pub fn required_locktime(&self) -> Option { self.set_locktime.clone() } @@ -330,7 +330,7 @@ pub enum PlanState { /// The plan is complete Complete { /// The script sig that should be set on the input - final_script_sig: Option