Skip to content

Commit

Permalink
remote-wallet: derivation-path crate doesn't like empty trailing ch…
Browse files Browse the repository at this point in the history
…ild indexes
  • Loading branch information
t-nelson committed Apr 27, 2021
1 parent 3d12be2 commit 4ce4f04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
22 changes: 0 additions & 22 deletions remote-wallet/src/remote_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,28 +536,6 @@ mod tests {
error: None,
}));
assert_eq!(derivation_path, DerivationPath::new_bip44(Some(1), Some(2)));
let (wallet_info, derivation_path) =
RemoteWalletInfo::parse_path(format!("usb://ledger/{:?}?key=1/2/", pubkey)).unwrap();
assert!(wallet_info.matches(&RemoteWalletInfo {
model: "nano-s".to_string(),
manufacturer: Vendor::Ledger,
serial: "".to_string(),
host_device_path: "/host/device/path".to_string(),
pubkey,
error: None,
}));
assert_eq!(derivation_path, DerivationPath::new_bip44(Some(1), Some(2)));
let (wallet_info, derivation_path) =
RemoteWalletInfo::parse_path(format!("usb://ledger/{:?}?key=1/", pubkey)).unwrap();
assert!(wallet_info.matches(&RemoteWalletInfo {
model: "nano-s".to_string(),
manufacturer: Vendor::Ledger,
serial: "".to_string(),
host_device_path: "/host/device/path".to_string(),
pubkey,
error: None,
}));
assert_eq!(derivation_path, DerivationPath::new_bip44(Some(1), None));

// Test that wallet id need not be complete for key derivation to work
let (wallet_info, derivation_path) =
Expand Down
6 changes: 5 additions & 1 deletion sdk/src/derivation_path.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
use {
core::{iter::IntoIterator, slice::Iter},
derivation_path::{ChildIndex, DerivationPath as DerivationPathInner},
std::{convert::{Infallible, TryFrom}, fmt, str::FromStr},
std::{
convert::{Infallible, TryFrom},
fmt,
str::FromStr,
},
thiserror::Error,
};

Expand Down

0 comments on commit 4ce4f04

Please sign in to comment.