Skip to content

Commit

Permalink
Some minor formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shesek committed Oct 17, 2024
1 parent 7d3e1e8 commit ae64ce6
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions src/descriptor/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,13 @@ impl DescriptorXKey<bip32::Xpriv> {
let xpub = bip32::Xpub::from_priv(secp, &xprv);

let origin = match &self.origin {
Some((fingerprint, path)) => Some((
*fingerprint,
path.into_iter()
.chain(hardened_path.iter())
.cloned()
.collect(),
)),
None => {
if hardened_path.is_empty() {
None
} else {
Some((self.xkey.fingerprint(secp), hardened_path.into()))
}
Some((fingerprint, path)) => {
Some((*fingerprint, path.into_iter().chain(hardened_path).copied().collect()))
}
None if !hardened_path.is_empty() => {
Some((self.xkey.fingerprint(secp), hardened_path.into()))
}
None => None,
};

Ok(DescriptorXKey {
Expand Down Expand Up @@ -306,13 +299,9 @@ impl DescriptorMultiXKey<bip32::Xpriv> {
let xpub = bip32::Xpub::from_priv(secp, &xprv);

let origin = match &self.origin {
Some((fingerprint, path)) => Some((
*fingerprint,
path.into_iter()
.chain(hardened_path.iter())
.copied()
.collect(),
)),
Some((fingerprint, path)) => {
Some((*fingerprint, path.into_iter().chain(hardened_path).copied().collect()))
}
None if !hardened_path.is_empty() => {
Some((self.xkey.fingerprint(secp), hardened_path.into()))
}
Expand Down

0 comments on commit ae64ce6

Please sign in to comment.