Add PlebStop feature
MODIFY
WalletWasabi/Blockchain/Keys/KeyManager.cs
WalletWasabi/Blockchain/Keys/KeyManager.cs
@@ -11,6 +11,7 @@ using WalletWasabi.Blockchain.Analysis.Clustering;
using WalletWasabi.Helpers;
using WalletWasabi.Io;
using WalletWasabi.JsonConverters;
+using WalletWasabi.JsonConverters.Bitcoin;
using WalletWasabi.Logging;
using WalletWasabi.Models;
using WalletWasabi.Wallets;
@@ -23,6 +24,7 @@ public class KeyManager
{
public const int AbsoluteMinGapLimit = 21;
public const int MaxGapLimit = 10_000;
+ public static Money DefaultPlebStopThreshold = Money.Coins(0.01m);
// BIP84-ish derivation scheme
// m / purpose' / coin_type' / account' / change / address_index
@@ -145,6 +147,10 @@ public class KeyManager
[JsonProperty(Order = 12, PropertyName = "AutoCoinJoin", DefaultValueHandling = DefaultValueHandling.Populate)]
public bool AutoCoinJoin { get; set; }
+ [JsonProperty(Order = 13, PropertyName = "PlebStopThreshold")]
+ [JsonConverter(typeof(MoneyBtcJsonConverter))]
+ public Money PlebStopThreshold { get; internal set; } = DefaultPlebStopThreshold;
+
private object BlockchainStateLock { get; }
private object HdPubKeysLock { get; }

MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
@@ -152,7 +152,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 && (x.NonPrivateCoins.TotalAmount() >= x.KeyManager.PlebStopThreshold)) || 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
@@ -95,6 +95,7 @@ public class Wallet : BackgroundService
public bool AllowManualCoinJoin { get; set; }
public Kitchen Kitchen { get; } = new();
+ public ICoinsView NonPrivateCoins => new CoinsView(Coins.Where(c => c.HdPubKey.AnonymitySet < ServiceConfiguration.MinAnonScoreTarget));
public bool TryLogin(string password, out string? compatibilityPasswordUsed)
{

Add PlebStop feature