@@ -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
@@ -200,16 +200,21 @@ mod test {
200
200
}
201
201
202
202
_i = 0 ;
203
- 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
+ ] {
204
209
let err = confidential_descriptor ( invalid_desc) . unwrap_err ( ) ;
205
- let text = "Descriptors without wildcards are not supported in elip151" . to_string ( ) ;
206
- assert_eq ! ( err, Error :: Unexpected ( text) ) ;
210
+ assert_eq ! ( err, expected_err) ;
207
211
/*
208
212
_i = _i + 1;
209
213
println!("* Invalid Test vector {}", _i);
210
214
println!("** Ordinary descriptor: <code>{}</code>", add_checksum(invalid_desc));
211
215
println!("** Invalid confidential descriptor: <code>{}</code>", add_checksum(&format!("ct(elip151,{})", invalid_desc)));
212
216
*/
213
217
}
218
+
214
219
}
215
220
}
0 commit comments