@@ -25,7 +25,7 @@ use bitcoin::hashes::{hash160, ripemd160, sha256, sha256d, Hash};
2525use bitcoin:: secp256k1;
2626use miniscript:: descriptor:: { SinglePub , SinglePubKey } ;
2727use miniscript:: {
28- Descriptor , DescriptorPublicKey , Miniscript , ScriptContext , TranslatePk , Translator ,
28+ Descriptor , DescriptorPublicKey , Error , Miniscript , ScriptContext , TranslatePk , Translator ,
2929} ;
3030use rand:: RngCore ;
3131
@@ -248,13 +248,15 @@ impl<'a> Translator<String, DescriptorPublicKey, ()> for StrTranslatorLoose<'a>
248248
249249#[ allow( dead_code) ]
250250// https://github.com/rust-lang/rust/issues/46379. The code is pub fn and integration test, but still shows warnings
251- pub fn parse_test_desc ( desc : & str , pubdata : & PubData ) -> Descriptor < DescriptorPublicKey > {
251+ pub fn parse_test_desc (
252+ desc : & str ,
253+ pubdata : & PubData ,
254+ ) -> Result < Descriptor < DescriptorPublicKey > , Error > {
252255 let desc = subs_hash_frag ( desc, pubdata) ;
253- let desc =
254- Descriptor :: < String > :: from_str ( & desc) . expect ( "only parsing valid and sane descriptors" ) ;
256+ let desc = Descriptor :: < String > :: from_str ( & desc) ?;
255257 let mut translator = StrDescPubKeyTranslator ( 0 , pubdata) ;
256258 let desc: Result < _ , ( ) > = desc. translate_pk ( & mut translator) ;
257- desc. expect ( "Translate must succeed" )
259+ Ok ( desc. expect ( "Translate must succeed" ) )
258260}
259261
260262// substitute hash fragments in the string as the per rules
0 commit comments