remote-wallet: `derivation-path` crate doesn't like empty trailing child indexes

This commit is contained in:
Trent Nelson 2021-04-24 01:59:14 -06:00 committed by Trent Nelson
parent 3d12be29ec
commit 4ce4f04c58
2 changed files with 5 additions and 23 deletions

View File

@ -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) =

View File

@ -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,
};