Simplify warning logic.
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
@@ -130,7 +130,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
CoordinatorFeePercent = registrableRound?.State?.CoordinatorFeePercent.ToString() ?? "0.003";
Observable.FromEventPattern(Global.ChaumianClient, nameof(Global.ChaumianClient.CoinQueued))
- .Merge(Observable.FromEventPattern(Global.ChaumianClient, nameof(Global.ChaumianClient.OnDequeued)))
+ .Merge(Observable.FromEventPattern(Global.ChaumianClient, nameof(Global.ChaumianClient.OnDequeue)))
.Merge(Observable.FromEventPattern(Global.ChaumianClient, nameof(Global.ChaumianClient.StateUpdated)))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(_ => UpdateStates())
@@ -198,15 +198,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
catch (Exception ex)
{
Logger.LogWarning(ex);
- var builder = new StringBuilder(ex.ToTypeMessageString());
- if (ex is AggregateException aggex)
- {
- foreach (var iex in aggex.InnerExceptions)
- {
- builder.Append(Environment.NewLine + iex.ToTypeMessageString());
- }
- }
- NotificationHelpers.Error(builder.ToString());
}
}
finally

MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -484,7 +484,7 @@ namespace WalletWasabi.Gui
CoinJoinProcessor.AddWalletService(WalletService);
WalletService.TransactionProcessor.WalletRelevantTransactionProcessed += TransactionProcessor_WalletRelevantTransactionProcessed;
- ChaumianClient.OnDequeued += ChaumianClient_OnDequeued;
+ ChaumianClient.OnDequeue += ChaumianClient_OnDequeued;
}
_cancelWalletServiceInitialization = null; // Must make it null explicitly, because dispose won't make it null.
}
@@ -501,41 +501,22 @@ namespace WalletWasabi.Gui
foreach (var success in e.Successful.Where(x => x.Value.Any()))
{
DequeueReason reason = success.Key;
- if (success.Value.Count() == 1)
- {
- var single = success.Value.First();
- NotificationHelpers.Information(reason.ToString(), $"Coin ({single.Amount.ToString(false, true)}) Dequeued");
- }
- else
- {
if (reason != DequeueReason.Spent)
{
- var message = reason.ToString();
- var title = $"{success.Value.Count()} Coins Dequeued";
- if (reason == DequeueReason.UserRequested)
- {
- NotificationHelpers.Information("", title);
- }
- else
- {
- NotificationHelpers.Warning(message, title);
- }
- }
+ var type = reason == DequeueReason.UserRequested ? NotificationType.Information : NotificationType.Warning;
+ var message = reason == DequeueReason.UserRequested ? "" : reason.ToString();
+ var title = success.Value.Count() == 1 ? $"Coin ({success.Value.First().Amount.ToString(false, true)}) Dequeued" : $"{success.Value.Count()} Coins Dequeued";
+ NotificationHelpers.Notify(message, title, type);
}
}
foreach (var failure in e.Unsuccessful.Where(x => x.Value.Any()))
{
DequeueReason reason = failure.Key;
- if (failure.Value.Count() == 1)
- {
- var single = failure.Value.First();
- NotificationHelpers.Warning(reason.ToString(), $"Couldn't Dequeue Coin ({single.Amount.ToString(false, true)})");
- }
- else
- {
- NotificationHelpers.Warning(reason.ToString(), $"Couldn't Dequeue {failure.Value.Count()} Coins");
- }
+ var type = NotificationType.Warning;
+ var message = reason.ToString();
+ var title = failure.Value.Count() == 1 ? $"Couldn't Dequeue Coin ({failure.Value.First().Amount.ToString(false, true)})" : $"Couldn't Dequeue {failure.Value.Count()} Coins";
+ NotificationHelpers.Notify(message, title, type);
}
}
catch (Exception ex)
@@ -713,7 +694,7 @@ namespace WalletWasabi.Gui
if (walletService is { })
{
WalletService.TransactionProcessor.WalletRelevantTransactionProcessed -= TransactionProcessor_WalletRelevantTransactionProcessed;
- ChaumianClient.OnDequeued -= ChaumianClient_OnDequeued;
+ ChaumianClient.OnDequeue -= ChaumianClient_OnDequeued;
}
try

MODIFY
WalletWasabi/CoinJoin/Client/Clients/CoinJoinClient.cs
WalletWasabi/CoinJoin/Client/Clients/CoinJoinClient.cs
@@ -52,7 +52,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
public event EventHandler<SmartCoin> CoinQueued;
- public event EventHandler<DequeueResult> OnDequeued;
+ public event EventHandler<DequeueResult> OnDequeue;
private long _frequentStatusProcessingIfNotMixing;
@@ -849,37 +849,6 @@ namespace WalletWasabi.CoinJoin.Client.Clients
}
}
- public bool HasIngredients => Salt != null && Soup != null;
-
- private string SaltSoup()
- {
- if (!HasIngredients)
- {
- return null;
- }
-
- string res;
- lock (RefrigeratorLock)
- {
- res = StringCipher.Decrypt(Soup, Salt);
- }
-
- Cook(res);
-
- return res;
- }
-
- private void Cook(string ingredients)
- {
- lock (RefrigeratorLock)
- {
- ingredients ??= "";
-
- Salt = TokenGenerator.GetUniqueKey(21);
- Soup = StringCipher.Encrypt(ingredients, Salt);
- }
- }
-
public async Task DequeueCoinsFromMixAsync(TxoRef coin, DequeueReason reason)
{
await DequeueCoinsFromMixAsync(new[] { coin }, reason).ConfigureAwait(false);
@@ -1010,9 +979,9 @@ namespace WalletWasabi.CoinJoin.Client.Clients
var result = new DequeueResult(successful.ToDictionary(x => x.Key, x => x.Value as IEnumerable<SmartCoin>), unsuccessful.ToDictionary(x => x.Key, x => x.Value as IEnumerable<SmartCoin>));
- if (result.Successful.Any())
+ if (result.Successful.Concat(result.Unsuccessful).Any())
{
- OnDequeued?.Invoke(this, result);
+ OnDequeue?.Invoke(this, result);
}
if (exceptions.Count == 1)
@@ -1027,6 +996,37 @@ namespace WalletWasabi.CoinJoin.Client.Clients
return result;
}
+ public bool HasIngredients => Salt != null && Soup != null;
+
+ private string SaltSoup()
+ {
+ if (!HasIngredients)
+ {
+ return null;
+ }
+
+ string res;
+ lock (RefrigeratorLock)
+ {
+ res = StringCipher.Decrypt(Soup, Salt);
+ }
+
+ Cook(res);
+
+ return res;
+ }
+
+ private void Cook(string ingredients)
+ {
+ lock (RefrigeratorLock)
+ {
+ ingredients ??= "";
+
+ Salt = TokenGenerator.GetUniqueKey(21);
+ Soup = StringCipher.Encrypt(ingredients, Salt);
+ }
+ }
+
public async Task StopAsync()
{
Synchronizer.ResponseArrived -= Synchronizer_ResponseArrivedAsync;

Simplify warning logic.