diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj index e0a5a2a..e6a653a 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.17 + 1.0.18 diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs index 6fdc4a6..e22fae5 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs @@ -175,7 +175,7 @@ public class BTCPayWallet : IWallet, IDestinationProvider return coordSettings.RoundWhenEnabled is not null && roundParameters.CoordinationFeeRate.Rate <= coordSettings.RoundWhenEnabled.CoordinationFeeRate && roundParameters.CoordinationFeeRate.PlebsDontPayThreshold <= - coordSettings.RoundWhenEnabled.PlebsDontPayThreshold && + coordSettings.RoundWhenEnabled.PlebsDontPayThresholdM && roundParameters.MinInputCountByRound <= coordSettings.RoundWhenEnabled.MinInputCountByRound; } catch (Exception e) diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiService.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiService.cs index bb85f3e..bd15b99 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiService.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiService.cs @@ -5,6 +5,7 @@ using BTCPayServer.Abstractions.Contracts; using BTCPayServer.Data; using BTCPayServer.PayoutProcessors; using BTCPayServer.Services; +using NBitcoin; using Newtonsoft.Json.Linq; namespace BTCPayServer.Plugins.Wabisabi @@ -38,6 +39,13 @@ namespace BTCPayServer.Plugins.Wabisabi var res = await _storeRepository.GetSettingAsync(storeId, nameof(WabisabiStoreSettings)); res ??= new WabisabiStoreSettings(); res.Settings = res.Settings.Where(settings => _ids.Contains(settings.Coordinator)).ToList(); + res.Settings.ForEach(settings => + { + if(settings.RoundWhenEnabled != null && string.IsNullOrEmpty(settings.RoundWhenEnabled.PlebsDontPayThreshold)) + { + settings.RoundWhenEnabled.PlebsDontPayThreshold = "1000000"; + } + }); foreach (var wabisabiCoordinatorManager in _coordinatorClientInstanceManager.HostedServices) { if (res.Settings.All(settings => settings.Coordinator != wabisabiCoordinatorManager.Key)) @@ -85,7 +93,7 @@ namespace BTCPayServer.Plugins.Wabisabi { CoordinationFeeRate = round.Value.CoinjoinState.Parameters.CoordinationFeeRate.Rate, PlebsDontPayThreshold = round.Value.CoinjoinState.Parameters.CoordinationFeeRate - .PlebsDontPayThreshold, + .PlebsDontPayThreshold.Satoshi.ToString(), MinInputCountByRound = round.Value.CoinjoinState.Parameters.MinInputCountByRound, }; } diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreSettings.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreSettings.cs index 3a9e47d..4fe8c25 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreSettings.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreSettings.cs @@ -46,7 +46,9 @@ public class LastCoordinatorRoundConfig { public decimal CoordinationFeeRate { get; set; } - [JsonConverter(typeof(MoneyJsonConverter))] - public Money PlebsDontPayThreshold { get; set; } + public string PlebsDontPayThreshold { get; set; } + [JsonIgnore] + public Money PlebsDontPayThresholdM => Money.Parse(PlebsDontPayThreshold); + public int MinInputCountByRound { get; set; } }