@@ -31,7 +31,7 @@ use std::sync::Arc;
3131
3232use bitcoin:: blockdata:: witness:: Witness ;
3333use bitcoin:: util:: address:: WitnessVersion ;
34- use bitcoin:: { self , secp256k1, Script } ;
34+ use bitcoin:: { self , secp256k1, Address , Network , Script , TxIn } ;
3535
3636use self :: checksum:: verify_checksum;
3737use crate :: miniscript:: { Legacy , Miniscript , Segwitv0 } ;
@@ -93,7 +93,7 @@ pub trait DescriptorTrait<Pk: MiniscriptKey> {
9393 /// Some descriptors like pk() don't have any address.
9494 /// Errors:
9595 /// - On raw/bare descriptors that don't have any address
96- fn address ( & self , network : bitcoin :: Network ) -> Result < bitcoin :: Address , Error >
96+ fn address ( & self , network : Network ) -> Result < Address , Error >
9797 where
9898 Pk : ToPublicKey ;
9999
@@ -142,7 +142,7 @@ pub trait DescriptorTrait<Pk: MiniscriptKey> {
142142 /// Attempts to produce a non-malleable satisfying witness and scriptSig to spend an
143143 /// output controlled by the given descriptor; add the data to a given
144144 /// `TxIn` output.
145- fn satisfy < S > ( & self , txin : & mut bitcoin :: TxIn , satisfier : S ) -> Result < ( ) , Error >
145+ fn satisfy < S > ( & self , txin : & mut TxIn , satisfier : S ) -> Result < ( ) , Error >
146146 where
147147 Pk : ToPublicKey ,
148148 S : Satisfier < Pk > ,
@@ -487,7 +487,7 @@ impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Descriptor<Pk> {
487487 }
488488 }
489489 /// Computes the Bitcoin address of the descriptor, if one exists
490- fn address ( & self , network : bitcoin :: Network ) -> Result < bitcoin :: Address , Error >
490+ fn address ( & self , network : Network ) -> Result < Address , Error >
491491 where
492492 Pk : ToPublicKey ,
493493 {
@@ -971,16 +971,14 @@ mod tests {
971971 )
972972 ) ;
973973 assert_eq ! (
974- bare. address( bitcoin:: Network :: Bitcoin )
975- . unwrap_err( )
976- . to_string( ) ,
974+ bare. address( Network :: Bitcoin ) . unwrap_err( ) . to_string( ) ,
977975 "Bare descriptors don't have address"
978976 ) ;
979977
980978 let pk = StdDescriptor :: from_str ( TEST_PK ) . unwrap ( ) ;
981979 assert_eq ! (
982980 pk. script_pubkey( ) ,
983- bitcoin :: Script :: from( vec![
981+ Script :: from( vec![
984982 0x21 , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
985983 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
986984 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x02 , 0xac ,
@@ -1007,7 +1005,7 @@ mod tests {
10071005 . into_script( )
10081006 ) ;
10091007 assert_eq ! (
1010- pkh. address( bitcoin :: Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1008+ pkh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
10111009 "1D7nRvrRgzCg9kYBwhPH3j3Gs6SmsRg3Wq"
10121010 ) ;
10131011
@@ -1028,9 +1026,7 @@ mod tests {
10281026 . into_script( )
10291027 ) ;
10301028 assert_eq ! (
1031- wpkh. address( bitcoin:: Network :: Bitcoin , )
1032- . unwrap( )
1033- . to_string( ) ,
1029+ wpkh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
10341030 "bc1qsn57m9drscflq5nl76z6ny52hck5w4x5wqd9yt"
10351031 ) ;
10361032
@@ -1052,10 +1048,7 @@ mod tests {
10521048 . into_script( )
10531049 ) ;
10541050 assert_eq ! (
1055- shwpkh
1056- . address( bitcoin:: Network :: Bitcoin , )
1057- . unwrap( )
1058- . to_string( ) ,
1051+ shwpkh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
10591052 "3PjMEzoveVbvajcnDDuxcJhsuqPHgydQXq"
10601053 ) ;
10611054
@@ -1077,7 +1070,7 @@ mod tests {
10771070 . into_script( )
10781071 ) ;
10791072 assert_eq ! (
1080- sh. address( bitcoin :: Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1073+ sh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
10811074 "3HDbdvM9CQ6ASnQFUkWw6Z4t3qNwMesJE9"
10821075 ) ;
10831076
@@ -1103,7 +1096,7 @@ mod tests {
11031096 . into_script( )
11041097 ) ;
11051098 assert_eq ! (
1106- wsh. address( bitcoin :: Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1099+ wsh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
11071100 "bc1qlymeahyfsv2jm3upw3urqp6m65ufde9seedl7umh0lth6yjt5zzsk33tv6"
11081101 ) ;
11091102
@@ -1125,10 +1118,7 @@ mod tests {
11251118 . into_script( )
11261119 ) ;
11271120 assert_eq ! (
1128- shwsh
1129- . address( bitcoin:: Network :: Bitcoin , )
1130- . unwrap( )
1131- . to_string( ) ,
1121+ shwsh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
11321122 "38cTksiyPT2b1uGRVbVqHdDhW9vKs84N6Z"
11331123 ) ;
11341124 }
0 commit comments