Raise event explaining why it cannot start
MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
@@ -91,10 +91,29 @@ public class CoinJoinManager : BackgroundService
foreach (var openedWallet in openedWallets.Select(x => x.Value))
{
NotifyMixableWalletLoaded(openedWallet);
- if (!CanStartAutoCoinJoin(openedWallet) && !MustStart(openedWallet))
+
+ if (!MustStart(openedWallet))
+ {
+ if (openedWallet.ElapsedTimeSinceStartup <= AutoCoinJoinDelayAfterWalletLoaded)
+ {
+ continue;
+ }
+ if (!openedWallet.KeyManager.AutoCoinJoin)
{
+ NotifyCoinJoinStartError(openedWallet, CoinjoinError.AutoConjoinDisabled);
continue;
}
+ if (IsUserInSendWorkflow)
+ {
+ NotifyCoinJoinStartError(openedWallet, CoinjoinError.UserInSendWorkflow);
+ continue;
+ }
+ if (openedWallet.NonPrivateCoins.TotalAmount() <= openedWallet.KeyManager.PlebStopThreshold)
+ {
+ NotifyCoinJoinStartError(openedWallet, CoinjoinError.NotEnoughUnprivateBalance);
+ continue;
+ }
+ }
var coinCandidates = SelectCandidateCoins(openedWallet).ToArray();
if (coinCandidates.Length == 0)
{
@@ -240,29 +259,4 @@ public class CoinJoinManager : BackgroundService
var pcPrivate = totalDecimalAmount == 0M ? 1d : (double)(privateDecimalAmount / totalDecimalAmount);
return pcPrivate;
}
-
- private bool CanStartAutoCoinJoin(Wallet wallet)
- {
- if (!wallet.KeyManager.AutoCoinJoin)
- {
- return false;
- }
-
- if (IsUserInSendWorkflow)
- {
- return false;
- }
-
- if (wallet.ElapsedTimeSinceStartup <= AutoCoinJoinDelayAfterWalletLoaded)
- {
- return false;
- }
-
- if (wallet.NonPrivateCoins.TotalAmount() <= wallet.KeyManager.PlebStopThreshold)
- {
- return false;
- }
-
- return true;
- }
}

MODIFY
WalletWasabi/WabiSabi/Client/StatusChangedEventArgs.cs
WalletWasabi/WabiSabi/Client/StatusChangedEventArgs.cs
@@ -77,5 +77,8 @@ public enum CompletionStatus
public enum CoinjoinError
{
- NoCoinsToMix
+ NoCoinsToMix,
+ AutoConjoinDisabled,
+ UserInSendWorkflow,
+ NotEnoughUnprivateBalance
}

Raise event explaining why it cannot start