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 @@ -725,12 +725,9 @@ impl Descriptor<DescriptorPublicKey> {
725
725
}
726
726
727
727
let descriptor = Descriptor :: < String > :: from_str ( s) ?;
728
- let descriptor = descriptor. translate_pk ( & mut keymap_pk) . map_err ( |e| {
729
- Error :: Unexpected (
730
- e. expect_translator_err ( "No Outer context errors" )
731
- . to_string ( ) ,
732
- )
733
- } ) ?;
728
+ let descriptor = descriptor
729
+ . translate_pk ( & mut keymap_pk)
730
+ . map_err ( TranslateErr :: flatten) ?;
734
731
735
732
Ok ( ( descriptor, keymap_pk. 0 ) )
736
733
}
Original file line number Diff line number Diff line change @@ -348,6 +348,17 @@ impl<E> TranslateErr<E> {
348
348
}
349
349
}
350
350
351
+ impl TranslateErr < Error > {
352
+ /// If we are doing a translation where our "outer error" is the generic
353
+ /// Miniscript error, eliminate the `TranslateErr` type which is just noise.
354
+ pub fn flatten ( self ) -> Error {
355
+ match self {
356
+ Self :: TranslatorErr ( e) => e,
357
+ Self :: OuterError ( e) => e,
358
+ }
359
+ }
360
+ }
361
+
351
362
impl < E > From < E > for TranslateErr < E > {
352
363
fn from ( v : E ) -> Self { Self :: TranslatorErr ( v) }
353
364
}
You can’t perform that action at this time.
0 commit comments