This commit is contained in:
Michael Vines
2020-12-13 17:26:34 -08:00
parent 0d139d7ef3
commit 7143aaa89b
102 changed files with 543 additions and 499 deletions

View File

@@ -260,11 +260,13 @@ impl RemoteWalletInfo {
));
}
let mut wallet_info = RemoteWalletInfo::default();
wallet_info.manufacturer = wallet_path.host_str().unwrap().to_string();
let mut wallet_info = RemoteWalletInfo {
manufacturer: wallet_path.host_str().unwrap().to_string(),
..RemoteWalletInfo::default()
};
if let Some(wallet_id) = wallet_path.path_segments().map(|c| c.collect::<Vec<_>>()) {
if wallet_id[0] != "" {
if !wallet_id[0].is_empty() {
wallet_info.pubkey = Pubkey::from_str(wallet_id[0]).map_err(|e| {
RemoteWalletError::InvalidDerivationPath(format!(
"pubkey from_str error: {:?}",
@@ -597,8 +599,10 @@ mod tests {
pubkey,
error: None,
};
let mut test_info = RemoteWalletInfo::default();
test_info.manufacturer = "Not Ledger".to_string();
let mut test_info = RemoteWalletInfo {
manufacturer: "Not Ledger".to_string(),
..RemoteWalletInfo::default()
};
assert!(!info.matches(&test_info));
test_info.manufacturer = "Ledger".to_string();
assert!(info.matches(&test_info));