@@ -227,20 +227,13 @@ impl DescriptorXKey<bip32::Xpriv> {
227227 let xpub = bip32:: Xpub :: from_priv ( secp, & xprv) ;
228228
229229 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 ( ) ) )
243232 }
233+ None if !hardened_path. is_empty ( ) => {
234+ Some ( ( self . xkey . fingerprint ( secp) , hardened_path. into ( ) ) )
235+ }
236+ None => None ,
244237 } ;
245238
246239 Ok ( DescriptorXKey {
@@ -306,13 +299,9 @@ impl DescriptorMultiXKey<bip32::Xpriv> {
306299 let xpub = bip32:: Xpub :: from_priv ( secp, & xprv) ;
307300
308301 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+ }
316305 None if !hardened_path. is_empty ( ) => {
317306 Some ( ( self . xkey . fingerprint ( secp) , hardened_path. into ( ) ) )
318307 }
0 commit comments