diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs
index ee12dd3..98c79b4 100644
--- a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs
+++ b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs
@@ -194,13 +194,17 @@ public class BTCPayCoinjoinCoinSelector : IRoundCoinSelector
{
continue;
}
+
+ //if we have less than the max suggested output registration, we should add more coins to reach that number to avoid breaking up into too many coins?
+ var isLessThanMaxOutputRegistration = solution.Coins.Count < 8;
var rand = Random.Shared.Next(1, 101);
//let's check how many coins we are allowed to add max and how many we added, and use that percentage as the random chance of not adding it.
// if max coins = 20, and current coins = 5 then 5/20 = 0.25 * 100 = 25
var maxCoinCapacityPercentage = Math.Floor((solution.Coins.Count / (decimal)maxCoins) * 100);
//aggressively attempt to reach max coin target if consolidation mode is on
- var chance = consolidationMode ? 90 : 100 - maxCoinCapacityPercentage;
+ //if we're less than the max output registration, we should be more aggressive in adding coins
+ var chance = consolidationMode ? 90 : 100m - Math.Min(maxCoinCapacityPercentage, isLessThanMaxOutputRegistration ? 50m : maxCoinCapacityPercentage);
_logger.LogDebug(
$"coin selection: no payms left but at {solution.Coins.Count()} coins. random chance to add another coin if: {chance} <= {rand} (random 0-100) ");
if (chance <= rand)
diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj
index 1de0f69..9ad958c 100644
--- a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj
+++ b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj
@@ -13,7 +13,7 @@
Wabisabi Coinjoin
Allows you to integrate your btcpayserver store with coinjoins.
- 1.0.34
+ 1.0.35
@@ -43,7 +43,7 @@
-
+