Add GetKeyManagers
MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWallets/LoadWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/LoadWallets/LoadWalletViewModel.cs
@@ -296,21 +296,13 @@ namespace WalletWasabi.Gui.Tabs.WalletManager.LoadWallets
Wallets.Clear();
Password = "";
- foreach (var file in Global.WalletManager.WalletDirectories.EnumerateWalletFiles())
- {
- var wallet = new LoadWalletEntry(Path.GetFileNameWithoutExtension(file.FullName));
- if (IsPasswordRequired)
- {
- if (KeyManager.TryGetEncryptedSecretFromFile(file.FullName, out _))
+ foreach (var wallet in Global.WalletManager
+ .GetKeyManagers()
+ .Where(x => !IsPasswordRequired || !x.IsWatchOnly) // If password isn't required then add the wallet, otherwise add only not watchonly wallets.
+ .Select(x => new LoadWalletEntry(x.WalletName)))
{
Wallets.Add(wallet);
}
- }
- else
- {
- Wallets.Add(wallet);
- }
- }
TrySetWalletStates();

MODIFY
WalletWasabi/Wallets/WalletManager.cs
WalletWasabi/Wallets/WalletManager.cs
@@ -80,18 +80,20 @@ namespace WalletWasabi.Wallets
}
}
- public IEnumerable<SmartLabel> GetLabels()
+ public IEnumerable<KeyManager> GetKeyManagers()
{
- var keyManagers = new List<KeyManager>();
lock (Lock)
{
- keyManagers = Wallets.Keys
+ return Wallets.Keys
.Where(x => x.KeyManager is { })
.Select(x => x.KeyManager)
.ToList();
}
+ }
- var labels = keyManagers
+ public IEnumerable<SmartLabel> GetLabels()
+ {
+ var labels = GetKeyManagers()
.SelectMany(x => x.GetLabels());
var txStore = BitcoinStore?.TransactionStore;

Add GetKeyManagers