From 4ce4f04c58fdbf67885add7a2c70f12e9261962c Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Sat, 24 Apr 2021 01:59:14 -0600 Subject: [PATCH] remote-wallet: `derivation-path` crate doesn't like empty trailing child indexes --- remote-wallet/src/remote_wallet.rs | 22 ---------------------- sdk/src/derivation_path.rs | 6 +++++- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/remote-wallet/src/remote_wallet.rs b/remote-wallet/src/remote_wallet.rs index 2a30e86a2a..fdcd971c7c 100644 --- a/remote-wallet/src/remote_wallet.rs +++ b/remote-wallet/src/remote_wallet.rs @@ -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) = diff --git a/sdk/src/derivation_path.rs b/sdk/src/derivation_path.rs index 2818c55293..36323245de 100644 --- a/sdk/src/derivation_path.rs +++ b/sdk/src/derivation_path.rs @@ -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, };