File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -731,12 +731,9 @@ impl Descriptor<DescriptorPublicKey> {
731
731
}
732
732
733
733
let descriptor = Descriptor :: < String > :: from_str ( s) ?;
734
- let descriptor = descriptor. translate_pk ( & mut keymap_pk) . map_err ( |e| {
735
- Error :: Unexpected (
736
- e. expect_translator_err ( "No Outer context errors" )
737
- . to_string ( ) ,
738
- )
739
- } ) ?;
734
+ let descriptor = descriptor
735
+ . translate_pk ( & mut keymap_pk)
736
+ . map_err ( TranslateErr :: flatten) ?;
740
737
741
738
Ok ( ( descriptor, keymap_pk. 0 ) )
742
739
}
Original file line number Diff line number Diff line change @@ -358,6 +358,17 @@ impl<E> TranslateErr<E> {
358
358
}
359
359
}
360
360
361
+ impl TranslateErr < Error > {
362
+ /// If we are doing a translation where our "outer error" is the generic
363
+ /// Miniscript error, eliminate the `TranslateErr` type which is just noise.
364
+ pub fn flatten ( self ) -> Error {
365
+ match self {
366
+ Self :: TranslatorErr ( e) => e,
367
+ Self :: OuterError ( e) => e,
368
+ }
369
+ }
370
+ }
371
+
361
372
impl < E > From < E > for TranslateErr < E > {
362
373
fn from ( v : E ) -> Self { Self :: TranslatorErr ( v) }
363
374
}
You can’t perform that action at this time.
0 commit comments