@@ -140,7 +140,7 @@ mod test {
140
140
desc : & str ,
141
141
) -> Result < ConfidentialDescriptor < DescriptorPublicKey > , Error > {
142
142
let desc = add_checksum ( desc) ;
143
- let desc = OrdinaryDescriptor :: < DescriptorPublicKey > :: from_str ( & desc) . unwrap ( ) ;
143
+ let desc = OrdinaryDescriptor :: < DescriptorPublicKey > :: from_str ( & desc) ? ;
144
144
ConfidentialDescriptor :: with_elip151_descriptor_blinding_key ( desc)
145
145
}
146
146
@@ -176,6 +176,8 @@ mod test {
176
176
for ( desc, key) in [
177
177
( & format ! ( "elwpkh({xpub}/<0;1>/*)" ) , "b3baf94d60cf8423cd257283575997a2c00664ced3e8de00f8726703142b1989" ) ,
178
178
( & format ! ( "elwpkh({xpub}/0/*)" ) , "de9c5fb624154624146a8aea0489b30f05c720eed6b493b1f3ab63405a11bf37" ) ,
179
+ ( & format ! ( "elwsh(multi(2,{xpub}/<0;1>/*,{xpub}/0/<0;1>/*))" ) , "7fcc1b9a20bbf611d157016192a7d28e353033cfa6a4885b3c48fa5ff9ce1881" ) ,
180
+ ( & format ! ( "elwsh(multi(2,{xpub}/<0;1>/*,{xpub}/0/<1;2>/*))" ) , "ff0a08050417f0ca95fb6ef7df979ae464739cb79b8c8f4b05408e0ac681a527" ) ,
179
181
] {
180
182
let conf_desc = confidential_descriptor ( desc) . unwrap ( ) ;
181
183
let elip151_desc = add_checksum ( & format ! ( "ct(elip151,{})" , desc) ) ;
@@ -198,16 +200,21 @@ mod test {
198
200
}
199
201
200
202
_i = 0 ;
201
- for invalid_desc in [ & format ! ( "elwpkh({xpub})" ) , & format ! ( "elwpkh({pubkey})" ) ] {
203
+ let text = "Descriptors without wildcards are not supported in elip151" . to_string ( ) ;
204
+ for ( invalid_desc, expected_err) in [
205
+ ( & format ! ( "elwpkh({xpub})" ) , Error :: Unexpected ( text. to_string ( ) ) ) ,
206
+ ( & format ! ( "elwpkh({pubkey})" ) , Error :: Unexpected ( text. to_string ( ) ) ) ,
207
+ ( & format ! ( "elwsh(multi(2,{xpub}/<0;1>/*,{xpub}/0/<0;1;2>/*))" ) , Error :: MultipathDescLenMismatch ) ,
208
+ ] {
202
209
let err = confidential_descriptor ( invalid_desc) . unwrap_err ( ) ;
203
- let text = "Descriptors without wildcards are not supported in elip151" . to_string ( ) ;
204
- assert_eq ! ( err, Error :: Unexpected ( text) ) ;
210
+ assert_eq ! ( err, expected_err) ;
205
211
/*
206
212
_i = _i + 1;
207
213
println!("* Invalid Test vector {}", _i);
208
214
println!("** Ordinary descriptor: <code>{}</code>", add_checksum(invalid_desc));
209
215
println!("** Invalid confidential descriptor: <code>{}</code>", add_checksum(&format!("ct(elip151,{})", invalid_desc)));
210
216
*/
211
217
}
218
+
212
219
}
213
220
}
0 commit comments