fix trezor t passphrase stuff
MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
@@ -104,7 +104,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
var mfpString = json["MasterFingerprint"].ToString();
// https://github.com/zkSNACKs/WalletWasabi/pull/1663#issuecomment-508073066
- // Coldcard 2.1.0 improperly implemented Wasabi skeleton fingerpring at first, so we must reverse byte order.
+ // Coldcard 2.1.0 improperly implemented Wasabi skeleton fingerprint at first, so we must reverse byte order.
// The solution was to add a ColdCardFirmwareVersion json field from 2.1.1 and correct the one generated by 2.1.0.
var coldCardVersionString = json["ColdCardFirmwareVersion"]?.ToString();
var reverseByteOrder = false;
@@ -467,24 +467,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
}
}
- if (selectedWallet.HardwareWalletInfo.Fingerprint is null)
- {
- throw new InvalidOperationException("Hardware wallet did not provide a master fingerprint.");
- }
-
- ExtPubKey extPubKey;
- var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
- try
- {
- MainWindowViewModel.Instance.StatusBar.TryAddStatus(StatusBarStatus.AcquiringXpubFromHardwareWallet);
- extPubKey = await client.GetXpubAsync(selectedWallet.HardwareWalletInfo.Fingerprint.Value, KeyManager.DefaultAccountKeyPath, cts.Token);
- }
- finally
- {
- cts?.Dispose();
- cts = null;
- MainWindowViewModel.Instance.StatusBar.TryRemoveStatus(StatusBarStatus.AcquiringXpubFromHardwareWallet);
- }
+ ExtPubKey extPubKey = await GetXpubAsync(selectedWallet, client);
Logger.LogInfo("Hardware wallet was not used previously on this computer. Creating new wallet file.");
@@ -566,6 +549,31 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
}
}
+ private static async Task<ExtPubKey> GetXpubAsync(LoadWalletEntry selectedWallet, HwiClient client)
+ {
+ ExtPubKey extPubKey;
+ var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
+ try
+ {
+ MainWindowViewModel.Instance.StatusBar.TryAddStatus(StatusBarStatus.AcquiringXpubFromHardwareWallet);
+ if (selectedWallet.HardwareWalletInfo.Fingerprint.HasValue)
+ {
+ extPubKey = await client.GetXpubAsync(selectedWallet.HardwareWalletInfo.Fingerprint.Value, KeyManager.DefaultAccountKeyPath, cts.Token);
+ }
+ else
+ {
+ extPubKey = await client.GetXpubAsync(selectedWallet.HardwareWalletInfo.Model, selectedWallet.HardwareWalletInfo.Path, KeyManager.DefaultAccountKeyPath, cts.Token);
+ }
+ }
+ finally
+ {
+ cts?.Dispose();
+ MainWindowViewModel.Instance.StatusBar.TryRemoveStatus(StatusBarStatus.AcquiringXpubFromHardwareWallet);
+ }
+
+ return extPubKey;
+ }
+
private async Task EnumerateHardwareWalletsAsync()
{
var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));

MODIFY
WalletWasabi/Hwi/HwiClient.cs
WalletWasabi/Hwi/HwiClient.cs
@@ -63,7 +63,8 @@ namespace WalletWasabi.Hwi
{
throw new OperationCanceledException($"'hwi {arguments}' operation is canceled.", ex);
}
- catch (HwiException ex) when (ex.ErrorCode == HwiErrorCode.DeviceConnError)
+ // HWI is inconsistent with error codes here.
+ catch (HwiException ex) when (ex.ErrorCode == HwiErrorCode.DeviceConnError || ex.ErrorCode == HwiErrorCode.DeviceNotReady)
{
// Probably didn't find device with specified fingerprint.
// Enumerate and call again, but not forever.

MODIFY
WalletWasabi/KeyManagement/KeyManager.cs
WalletWasabi/KeyManagement/KeyManager.cs
@@ -155,9 +155,9 @@ namespace WalletWasabi.KeyManagement
return new KeyManager(null, null, null, extPubKey, null, AbsoluteMinGapLimit, new BlockchainState(), filePath);
}
- public static KeyManager CreateNewHardwareWalletWatchOnly(HDFingerprint masterFingerpring, ExtPubKey extPubKey, string filePath = null)
+ public static KeyManager CreateNewHardwareWalletWatchOnly(HDFingerprint masterFingerprint, ExtPubKey extPubKey, string filePath = null)
{
- return new KeyManager(null, null, masterFingerpring, extPubKey, null, AbsoluteMinGapLimit, new BlockchainState(), filePath);
+ return new KeyManager(null, null, masterFingerprint, extPubKey, null, AbsoluteMinGapLimit, new BlockchainState(), filePath);
}
public static KeyManager Recover(Mnemonic mnemonic, string password, string filePath = null, KeyPath accountKeyPath = null, int minGapLimit = AbsoluteMinGapLimit)

fix trezor t passphrase stuff