Make sure we handle the faulted tasks
MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
@@ -90,24 +90,31 @@ namespace WalletWasabi.WabiSabi.Client
trackedWallets.Remove(finishedCoinJoin.Wallet.WalletName);
finishedCoinJoin.CancellationTokenSource.Dispose();
- var finishedCoinJoinTask = finishedCoinJoin.CoinJoinTask;
- if (finishedCoinJoinTask.IsCompletedSuccessfully)
+ try
+ {
+ var success = await finishedCoinJoin.CoinJoinTask.ConfigureAwait(false);
+ if (success)
{
Logger.LogInfo("Coinjoin client finished successfully!");
}
- else if (finishedCoinJoinTask.IsFaulted)
+ else
{
- if (finishedCoinJoinTask.Exception?.InnerException is InvalidOperationException ioe)
+ Logger.LogInfo("Coinjoin client finished with error. Transaction not broadcasted.");
+ }
+ }
+ catch (InvalidOperationException ioe)
{
+ Logger.LogError(ioe);
await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken).ConfigureAwait(false);
- continue;
}
- Logger.LogError(finishedCoinJoinTask.Exception!);
- }
- else if (finishedCoinJoinTask.IsCanceled)
+ catch (OperationCanceledException)
{
Logger.LogInfo("Coinjoin client was cancelled.");
}
+ catch (Exception e)
+ {
+ Logger.LogError(e);
+ }
}
TrackedWallets = trackedWallets.ToImmutableDictionary();

Make sure we handle the faulted tasks