@@ -31,7 +31,7 @@ use std::sync::Arc;
31
31
32
32
use bitcoin:: blockdata:: witness:: Witness ;
33
33
use bitcoin:: util:: address:: WitnessVersion ;
34
- use bitcoin:: { self , secp256k1, Script } ;
34
+ use bitcoin:: { self , secp256k1, Address , Network , Script , TxIn } ;
35
35
36
36
use self :: checksum:: verify_checksum;
37
37
use crate :: miniscript:: { Legacy , Miniscript , Segwitv0 } ;
@@ -93,7 +93,7 @@ pub trait DescriptorTrait<Pk: MiniscriptKey> {
93
93
/// Some descriptors like pk() don't have any address.
94
94
/// Errors:
95
95
/// - 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 >
97
97
where
98
98
Pk : ToPublicKey ;
99
99
@@ -142,7 +142,7 @@ pub trait DescriptorTrait<Pk: MiniscriptKey> {
142
142
/// Attempts to produce a non-malleable satisfying witness and scriptSig to spend an
143
143
/// output controlled by the given descriptor; add the data to a given
144
144
/// `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 >
146
146
where
147
147
Pk : ToPublicKey ,
148
148
S : Satisfier < Pk > ,
@@ -487,7 +487,7 @@ impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Descriptor<Pk> {
487
487
}
488
488
}
489
489
/// 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 >
491
491
where
492
492
Pk : ToPublicKey ,
493
493
{
@@ -971,16 +971,14 @@ mod tests {
971
971
)
972
972
) ;
973
973
assert_eq ! (
974
- bare. address( bitcoin:: Network :: Bitcoin )
975
- . unwrap_err( )
976
- . to_string( ) ,
974
+ bare. address( Network :: Bitcoin ) . unwrap_err( ) . to_string( ) ,
977
975
"Bare descriptors don't have address"
978
976
) ;
979
977
980
978
let pk = StdDescriptor :: from_str ( TEST_PK ) . unwrap ( ) ;
981
979
assert_eq ! (
982
980
pk. script_pubkey( ) ,
983
- bitcoin :: Script :: from( vec![
981
+ Script :: from( vec![
984
982
0x21 , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
985
983
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
986
984
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x02 , 0xac ,
@@ -1007,7 +1005,7 @@ mod tests {
1007
1005
. into_script( )
1008
1006
) ;
1009
1007
assert_eq ! (
1010
- pkh. address( bitcoin :: Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1008
+ pkh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1011
1009
"1D7nRvrRgzCg9kYBwhPH3j3Gs6SmsRg3Wq"
1012
1010
) ;
1013
1011
@@ -1028,9 +1026,7 @@ mod tests {
1028
1026
. into_script( )
1029
1027
) ;
1030
1028
assert_eq ! (
1031
- wpkh. address( bitcoin:: Network :: Bitcoin , )
1032
- . unwrap( )
1033
- . to_string( ) ,
1029
+ wpkh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1034
1030
"bc1qsn57m9drscflq5nl76z6ny52hck5w4x5wqd9yt"
1035
1031
) ;
1036
1032
@@ -1052,10 +1048,7 @@ mod tests {
1052
1048
. into_script( )
1053
1049
) ;
1054
1050
assert_eq ! (
1055
- shwpkh
1056
- . address( bitcoin:: Network :: Bitcoin , )
1057
- . unwrap( )
1058
- . to_string( ) ,
1051
+ shwpkh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1059
1052
"3PjMEzoveVbvajcnDDuxcJhsuqPHgydQXq"
1060
1053
) ;
1061
1054
@@ -1077,7 +1070,7 @@ mod tests {
1077
1070
. into_script( )
1078
1071
) ;
1079
1072
assert_eq ! (
1080
- sh. address( bitcoin :: Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1073
+ sh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1081
1074
"3HDbdvM9CQ6ASnQFUkWw6Z4t3qNwMesJE9"
1082
1075
) ;
1083
1076
@@ -1103,7 +1096,7 @@ mod tests {
1103
1096
. into_script( )
1104
1097
) ;
1105
1098
assert_eq ! (
1106
- wsh. address( bitcoin :: Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1099
+ wsh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1107
1100
"bc1qlymeahyfsv2jm3upw3urqp6m65ufde9seedl7umh0lth6yjt5zzsk33tv6"
1108
1101
) ;
1109
1102
@@ -1125,10 +1118,7 @@ mod tests {
1125
1118
. into_script( )
1126
1119
) ;
1127
1120
assert_eq ! (
1128
- shwsh
1129
- . address( bitcoin:: Network :: Bitcoin , )
1130
- . unwrap( )
1131
- . to_string( ) ,
1121
+ shwsh. address( Network :: Bitcoin , ) . unwrap( ) . to_string( ) ,
1132
1122
"38cTksiyPT2b1uGRVbVqHdDhW9vKs84N6Z"
1133
1123
) ;
1134
1124
}
0 commit comments