Improve Trezor setup
MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
@@ -321,34 +321,34 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
var password = Guard.Correct(Password); // Don't let whitespaces to the beginning and to the end.
Password = ""; // Clear password field.
- if (SelectedWallet is null)
+ var selectedWallet = SelectedWallet;
+ if (selectedWallet is null)
{
SetValidationMessage("No wallet selected.");
return null;
}
- var selectedWallet = SelectedWallet;
var walletName = selectedWallet.WalletName;
if (isHardwareWallet)
{
- if (selectedWallet is null)
+ if (selectedWallet.HardwareWalletInfo is null)
{
SetValidationMessage("No hardware wallets detected.");
return null;
}
- if (selectedWallet.HardwareWalletInfo.MasterFingerprint is null)
- {
- if (selectedWallet.HardwareWalletInfo.Error.Contains("Not initialized", StringComparison.InvariantCultureIgnoreCase))
+ if (!selectedWallet.HardwareWalletInfo.Initialized)
{
await HwiProcessManager.SetupAsync(selectedWallet.HardwareWalletInfo);
var hwis = await HwiProcessManager.EnumerateAsync();
TryRefreshHardwareWallets(hwis);
+ return await LoadKeyManagerAsync(requirePassword, isHardwareWallet);
}
+
+ if (selectedWallet.HardwareWalletInfo.MasterFingerprint is null)
{
throw new InvalidOperationException("Hardware wallet didn't provided a master fingerprint.");
}
- }
if (!TryFindWalletByMasterFingerprint(selectedWallet.HardwareWalletInfo.MasterFingerprint.Value, out walletName))
{

MODIFY
WalletWasabi/Hwi/Models/HardwareWalletInfo.cs
WalletWasabi/Hwi/Models/HardwareWalletInfo.cs
@@ -25,9 +25,19 @@ namespace WalletWasabi.Hwi.Models
Type = type;
Path = path;
Error = error;
+
+ if (Error != null && Error.Contains("Not initialized", StringComparison.InvariantCultureIgnoreCase))
+ {
+ Initialized = false;
+ }
+ else
+ {
+ Initialized = true;
+ }
}
public HDFingerprint? MasterFingerprint { get; }
+ public bool Initialized { get; }
public string SerialNumber { get; }
public HardwareWalletType Type { get; }
public string Path { get; }

Improve Trezor setup