Adding a hack to solve edge case when changing the AutoCoinJoin in settings
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/CoinJoinStateViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/CoinJoinStateViewModel.cs
@@ -129,6 +129,7 @@ public partial class CoinJoinStateViewModel : ViewModelBase
else
{
await coinJoinManager.StopAsync(_wallet, CancellationToken.None);
+ _stateMachine.Fire(Trigger.AutoCoinJoinOff);
}
});
@@ -171,7 +172,9 @@ public partial class CoinJoinStateViewModel : ViewModelBase
EnterCriticalPhaseMessage,
ExitCriticalPhaseMessage,
WalletStartedCoinJoin,
- WalletStoppedCoinJoin
+ WalletStoppedCoinJoin,
+ AutoCoinJoinOff,
+ AutoCoinJoinOn
}
private bool IsCountDownFinished => GetRemainingTime() <= TimeSpan.Zero;
@@ -193,6 +196,7 @@ public partial class CoinJoinStateViewModel : ViewModelBase
_stateMachine.Configure(State.WaitingForAutoStart)
.Permit(Trigger.WalletStartedCoinJoin, State.Playing)
+ .Permit(Trigger.AutoCoinJoinOff, State.StopOrPause)
.OnEntry(() =>
{
PlayVisible = true;

MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
@@ -135,8 +135,18 @@ public class CoinJoinManager : BackgroundService
{
var walletToStart = startCommand.Wallet;
if (trackedCoinJoins.TryGetValue(walletToStart.WalletName, out var tracker))
+ {
+ if (startCommand.StopWhenAllMixed != tracker.StopWhenAllMixed)
+ {
+ tracker.StopWhenAllMixed = startCommand.StopWhenAllMixed;
+
+ walletToStart.LogDebug($"Cannot start coinjoin, because it is already running - but updated the value of {nameof(startCommand.StopWhenAllMixed)} to {startCommand.StopWhenAllMixed}.");
+ }
+ else
{
walletToStart.LogDebug("Cannot start coinjoin, because it is already running.");
+ }
+
return;
}

MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinTracker.cs
WalletWasabi/WabiSabi/Client/CoinJoinTracker.cs
@@ -38,7 +38,7 @@ public class CoinJoinTracker : IDisposable
public Wallet Wallet { get; }
public Task<CoinJoinResult> CoinJoinTask { get; }
public IEnumerable<SmartCoin> CoinCandidates { get; }
- public bool StopWhenAllMixed { get; }
+ public bool StopWhenAllMixed { get; set; }
public bool OverridePlebStop { get; }
public bool IsCompleted => CoinJoinTask.IsCompleted;

Adding a hack to solve edge case when changing the AutoCoinJoin in settings