remove coins one-by-one and suppress coinjoin exceptions
MODIFY
WalletWasabi.Gui/Dialogs/CannotCloseDialogViewModel.cs
WalletWasabi.Gui/Dialogs/CannotCloseDialogViewModel.cs
@@ -4,11 +4,13 @@ using AvalonStudio.Extensibility.Dialogs;
using ReactiveUI;
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Reactive.Disposables;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi;
+using WalletWasabi.Models;
namespace WalletWasabi.Gui.Dialogs
{
@@ -100,7 +102,6 @@ namespace WalletWasabi.Gui.Dialogs
}
start = DateTime.Now;
- await Task.Delay(10000);
bool last = false;
while (!last)
{
@@ -108,7 +109,27 @@ namespace WalletWasabi.Gui.Dialogs
if (_cancelTokenSource.IsCancellationRequested) break;
try
{
- await Global.DesperateDequeueAllCoinsAsync();
+ if (Global.WalletService is null || Global.ChaumianClient is null)
+ return;
+ SmartCoin[] enqueuedCoins = Global.WalletService.Coins.Where(x => x.CoinJoinInProgress).ToArray();
+ Exception latestException = null;
+ foreach (var coin in enqueuedCoins)
+ {
+ try
+ {
+ if (_cancelTokenSource.IsCancellationRequested) break;
+ await Global.ChaumianClient.DequeueCoinsFromMixAsync(new SmartCoin[] { coin }); //dequeue coins one-by-one to check abort flag more frequently
+ }
+ catch (Exception ex)
+ {
+ latestException = ex;
+
+ if (last) //if this is the last iteration and we are still failing then we throw the exception
+ throw ex;
+ }
+ }
+
+ if (latestException is null) //no exceptions were thrown during the for-each so we are done with dequeuing
last = true;
}
catch (Exception ex)

MODIFY
WalletWasabi/Services/CcjClient.cs
WalletWasabi/Services/CcjClient.cs
@@ -239,7 +239,6 @@ namespace WalletWasabi.Services
}
await DequeueCoinsFromMixNoLockAsync(State.GetSpentCoins().ToArray());
- if (IsQuitPending) await DequeueAllCoinsFromMixNoLockAsync();
CcjClientRound inputRegistrableRound = State.GetRegistrableRoundOrDefault();
if (!(inputRegistrableRound is null))
{

remove coins one-by-one and suppress coinjoin exceptions