diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs index 8b02dc8..e917f3b 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs @@ -162,6 +162,21 @@ public class BTCPayWallet : IWallet, IDestinationProvider return _coinSelector; } + public bool IsRoundOk(RoundParameters roundParameters, string coordinatorName) + { + var coordSettings = WabisabiStoreSettings.Settings.Find(settings => settings.Coordinator == coordinatorName && settings.Enabled); + return coordSettings is not null && IsRoundOk(roundParameters, coordSettings); + } + public static bool IsRoundOk(RoundParameters roundParameters, WabisabiStoreCoordinatorSettings coordSettings) + { + if (coordSettings.RoundWhenEnabled is null) + { + return false; + } + return roundParameters.CoordinationFeeRate.Rate <= coordSettings.RoundWhenEnabled.CoordinationFeeRate && + roundParameters.CoordinationFeeRate.PlebsDontPayThreshold <= coordSettings.RoundWhenEnabled.PlebsDontPayThreshold && + roundParameters.MinInputCountByRound <= coordSettings.RoundWhenEnabled.MinInputCountByRound; + } public async Task> GetCoinjoinCoinCandidatesAsync(string coordinatorName) { try diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml index 861f41b..1c406bf 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml @@ -43,8 +43,6 @@
@{ - - var wallet = await WalletProvider.GetWalletAsync(storeId); if (wallet is BTCPayWallet btcPayWallet) { @@ -283,19 +281,39 @@ data-bs-toggle="modal" data-bs-target="#config-@s.Coordinator"> Coordinator Config + @if (Model.Settings[index].RoundWhenEnabled is not null && !BTCPayWallet.IsRoundOk(round, Model.Settings[index])) + { +
Round fees/parameters changed. Coinjoins will not occur unless you accept the new parameters.
+ } } + + + By enabling this coordinator, you agree to their terms and conditions. + -
- - - By enabling this coordinator, you agree to their terms and conditions. - + @{ + var canEnable = coordinator.WasabiCoordinatorStatusFetcher.Connected && coordinator.RoundStateUpdater.AnyRound; + } +
+ @if (Model.Settings[index].RoundWhenEnabled is not null) + { + + + + } + + +
@@ -343,7 +361,7 @@ } -