@@ -227,20 +227,13 @@ impl DescriptorXKey<bip32::Xpriv> {
227
227
let xpub = bip32:: Xpub :: from_priv ( secp, & xprv) ;
228
228
229
229
let origin = match & self . origin {
230
- Some ( ( fingerprint, path) ) => Some ( (
231
- * fingerprint,
232
- path. into_iter ( )
233
- . chain ( hardened_path. iter ( ) )
234
- . cloned ( )
235
- . collect ( ) ,
236
- ) ) ,
237
- None => {
238
- if hardened_path. is_empty ( ) {
239
- None
240
- } else {
241
- Some ( ( self . xkey . fingerprint ( secp) , hardened_path. into ( ) ) )
242
- }
230
+ Some ( ( fingerprint, path) ) => {
231
+ Some ( ( * fingerprint, path. into_iter ( ) . chain ( hardened_path) . copied ( ) . collect ( ) ) )
243
232
}
233
+ None if !hardened_path. is_empty ( ) => {
234
+ Some ( ( self . xkey . fingerprint ( secp) , hardened_path. into ( ) ) )
235
+ }
236
+ None => None ,
244
237
} ;
245
238
246
239
Ok ( DescriptorXKey {
@@ -306,13 +299,9 @@ impl DescriptorMultiXKey<bip32::Xpriv> {
306
299
let xpub = bip32:: Xpub :: from_priv ( secp, & xprv) ;
307
300
308
301
let origin = match & self . origin {
309
- Some ( ( fingerprint, path) ) => Some ( (
310
- * fingerprint,
311
- path. into_iter ( )
312
- . chain ( hardened_path. iter ( ) )
313
- . copied ( )
314
- . collect ( ) ,
315
- ) ) ,
302
+ Some ( ( fingerprint, path) ) => {
303
+ Some ( ( * fingerprint, path. into_iter ( ) . chain ( hardened_path) . copied ( ) . collect ( ) ) )
304
+ }
316
305
None if !hardened_path. is_empty ( ) => {
317
306
Some ( ( self . xkey . fingerprint ( secp) , hardened_path. into ( ) ) )
318
307
}
0 commit comments