1616//! witness/script_sig for the input.
1717use bdk_chain:: { bitcoin, collections:: * , miniscript} ;
1818use bitcoin:: {
19- blockdata:: { locktime:: LockTime , transaction:: Sequence } ,
19+ absolute,
20+ address:: WitnessVersion ,
21+ bip32:: { DerivationPath , Fingerprint , KeySource } ,
22+ blockdata:: transaction:: Sequence ,
23+ ecdsa,
2024 hashes:: { hash160, ripemd160, sha256} ,
2125 secp256k1:: Secp256k1 ,
22- util:: {
23- address:: WitnessVersion ,
24- bip32:: { DerivationPath , Fingerprint , KeySource } ,
25- taproot:: { LeafVersion , TapBranchHash , TapLeafHash } ,
26- } ,
27- EcdsaSig , SchnorrSig , Script , TxIn , Witness ,
26+ taproot:: { self , LeafVersion , TapLeafHash } ,
27+ ScriptBuf , TxIn , Witness ,
2828} ;
2929use miniscript:: {
3030 descriptor:: { InnerXKey , Tr } ,
@@ -46,7 +46,7 @@ use template::TemplateItem;
4646enum TrSpend {
4747 KeySpend ,
4848 LeafSpend {
49- script : Script ,
49+ script : ScriptBuf ,
5050 leaf_version : LeafVersion ,
5151 } ,
5252}
@@ -55,7 +55,7 @@ enum TrSpend {
5555enum Target {
5656 Legacy ,
5757 Segwitv0 {
58- script_code : Script ,
58+ script_code : ScriptBuf ,
5959 } ,
6060 Segwitv1 {
6161 tr : Tr < DefiniteDescriptorKey > ,
@@ -72,7 +72,7 @@ impl Target {}
7272pub struct Plan < AK > {
7373 template : Vec < TemplateItem < AK > > ,
7474 target : Target ,
75- set_locktime : Option < LockTime > ,
75+ set_locktime : Option < absolute :: LockTime > ,
7676 set_sequence : Option < Sequence > ,
7777}
7878
@@ -86,9 +86,9 @@ impl Default for Target {
8686/// Signatures and hash pre-images that can be used to complete a plan.
8787pub struct SatisfactionMaterial {
8888 /// Schnorr signautres under their keys
89- pub schnorr_sigs : BTreeMap < DefiniteDescriptorKey , SchnorrSig > ,
89+ pub schnorr_sigs : BTreeMap < DefiniteDescriptorKey , taproot :: Signature > ,
9090 /// ECDSA signatures under their keys
91- pub ecdsa_sigs : BTreeMap < DefiniteDescriptorKey , EcdsaSig > ,
91+ pub ecdsa_sigs : BTreeMap < DefiniteDescriptorKey , ecdsa :: Signature > ,
9292 /// SHA256 pre-images under their images
9393 pub sha256_preimages : BTreeMap < sha256:: Hash , Vec < u8 > > ,
9494 /// hash160 pre-images under their images
@@ -201,7 +201,7 @@ where
201201 ..
202202 } => PlanState :: Complete {
203203 final_script_sig : None ,
204- final_script_witness : Some ( Witness :: from_vec ( witness) ) ,
204+ final_script_witness : Some ( Witness :: from ( witness) ) ,
205205 } ,
206206 Target :: Segwitv1 {
207207 tr,
@@ -220,7 +220,7 @@ where
220220
221221 PlanState :: Complete {
222222 final_script_sig : None ,
223- final_script_witness : Some ( Witness :: from_vec ( witness) ) ,
223+ final_script_witness : Some ( Witness :: from ( witness) ) ,
224224 }
225225 }
226226 }
@@ -306,7 +306,7 @@ where
306306 }
307307
308308 /// The minimum required locktime height or time on the transaction using the plan.
309- pub fn required_locktime ( & self ) -> Option < LockTime > {
309+ pub fn required_locktime ( & self ) -> Option < absolute :: LockTime > {
310310 self . set_locktime . clone ( )
311311 }
312312
@@ -330,7 +330,7 @@ pub enum PlanState<Ak> {
330330 /// The plan is complete
331331 Complete {
332332 /// The script sig that should be set on the input
333- final_script_sig : Option < Script > ,
333+ final_script_sig : Option < ScriptBuf > ,
334334 /// The witness that should be set on the input
335335 final_script_witness : Option < Witness > ,
336336 } ,
@@ -341,7 +341,7 @@ pub enum PlanState<Ak> {
341341pub struct Assets < K > {
342342 pub keys : Vec < K > ,
343343 pub txo_age : Option < Sequence > ,
344- pub max_locktime : Option < LockTime > ,
344+ pub max_locktime : Option < absolute :: LockTime > ,
345345 pub sha256 : Vec < sha256:: Hash > ,
346346 pub hash256 : Vec < hash256:: Hash > ,
347347 pub ripemd160 : Vec < ripemd160:: Hash > ,
@@ -380,6 +380,11 @@ impl CanDerive for KeySource {
380380
381381 path_to_child ( self , & origin, Some ( & dxk. derivation_path ) )
382382 }
383+ DescriptorPublicKey :: MultiXPub ( _) => {
384+ // This crate will be replaced by
385+ // https://github.com/rust-bitcoin/rust-miniscript/pull/481 anyways
386+ todo ! ( ) ;
387+ }
383388 }
384389 }
385390}
0 commit comments