Add delay logic
MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
@@ -31,6 +31,7 @@ public class CoinJoinManager : BackgroundService
public ServiceConfiguration ServiceConfiguration { get; }
private ImmutableDictionary<string, CoinJoinTrackingData> TrackedWallets { get; set; } = ImmutableDictionary<string, CoinJoinTrackingData>.Empty;
private CoinRefrigerator CoinRefrigerator { get; } = new();
+ private TimeSpan AutoCoinJoinDelayAfterWalletLoaded { get; } = TimeSpan.FromMinutes(Random.Shared.Next(5, 16));
public CoinJoinClientState HighestCoinJoinClientState
{
@@ -150,7 +151,7 @@ public class CoinJoinManager : BackgroundService
private ImmutableDictionary<string, Wallet> GetMixableWallets() =>
WalletManager.GetWallets()
.Where(x => x.State == WalletState.Started) // Only running wallets
- .Where(x => x.KeyManager.AutoCoinJoin || x.AllowManualCoinJoin) // configured to be mixed automatically or manually
+ .Where(x => (x.KeyManager.AutoCoinJoin && (DateTimeOffset.UtcNow - x.StartedTime) > AutoCoinJoinDelayAfterWalletLoaded) || x.AllowManualCoinJoin) // configured to be mixed automatically or manually
.Where(x => !x.KeyManager.IsWatchOnly) // that are not watch-only wallets
.Where(x => x.Kitchen.HasIngredients)
.ToImmutableDictionary(x => x.WalletName, x => x);

MODIFY
WalletWasabi/Wallets/Wallet.cs
WalletWasabi/Wallets/Wallet.cs
@@ -71,6 +71,7 @@ public class Wallet : BackgroundService
}
}
+ public DateTimeOffset StartedTime { get; private set; }
public BitcoinStore BitcoinStore { get; private set; }
public KeyManager KeyManager { get; }
public WasabiSynchronizer Synchronizer { get; private set; }
@@ -190,6 +191,7 @@ public class Wallet : BackgroundService
await base.StartAsync(cancel).ConfigureAwait(false);
State = WalletState.Started;
+ StartedTime = DateTimeOffset.UtcNow;
}
catch
{

Add delay logic