Remove saving of the not-opened wallets on quit.
MODIFY
WalletWasabi/Wallets/WalletManager.cs
WalletWasabi/Wallets/WalletManager.cs
@@ -337,17 +337,9 @@ namespace WalletWasabi.Wallets
using (await StartStopWalletLock.LockAsync(cancel).ConfigureAwait(false))
{
- List<Wallet> walletsListClone;
- lock (Lock)
- {
- walletsListClone = Wallets.Keys.ToList();
- }
- foreach (var wallet in walletsListClone)
+ foreach (var wallet in GetWallets())
{
- if (cancel.IsCancellationRequested)
- {
- return;
- }
+ cancel.ThrowIfCancellationRequested();
wallet.WalletRelevantTransactionProcessed -= TransactionProcessor_WalletRelevantTransactionProcessed;
wallet.OnDequeue -= ChaumianClient_OnDequeue;
@@ -362,15 +354,18 @@ namespace WalletWasabi.Wallets
}
try
+ {
+ if (wallet.State >= WalletState.Initialized)
{
var keyManager = wallet.KeyManager;
string backupWalletFilePath = WalletDirectories.GetWalletFilePaths(Path.GetFileName(keyManager.FilePath)).walletBackupFilePath;
keyManager.ToFile(backupWalletFilePath);
Logger.LogInfo($"{nameof(wallet.KeyManager)} backup saved to `{backupWalletFilePath}`.");
await wallet.StopAsync(cancel).ConfigureAwait(false);
- wallet?.Dispose();
Logger.LogInfo($"{nameof(Wallet)} is stopped.");
}
+ wallet?.Dispose();
+ }
catch (Exception ex)
{
Logger.LogError(ex);

Remove saving of the not-opened wallets on quit.