diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs index 013b8ee..99ed025 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs @@ -72,12 +72,6 @@ SmartCoin[] FilterCoinsMore(IEnumerable coins) return true; } - if (_wallet.WabisabiStoreSettings.PlebMode || - _wallet.WabisabiStoreSettings.CrossMixBetweenCoordinatorsMode == - WabisabiStoreSettings.CrossMixMode.WhenFree) - { - return coin.Amount <= roundParameters.CoordinationFeeRate.PlebsDontPayThreshold; - } return false; diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj index 11f7c9f..57586ed 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj @@ -44,7 +44,7 @@ - + diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs index fcbd1e5..381cd4a 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs @@ -286,8 +286,7 @@ public class BTCPayWallet : IWallet, IDestinationProvider { return coordSettings.RoundWhenEnabled is not null && roundParameters.CoordinationFeeRate.Rate <= coordSettings.RoundWhenEnabled.CoordinationFeeRate && - roundParameters.CoordinationFeeRate.PlebsDontPayThreshold <= - coordSettings.RoundWhenEnabled.PlebsDontPayThresholdM && + roundParameters.MinInputCountByRound <= coordSettings.RoundWhenEnabled.MinInputCountByRound; } catch (Exception e) diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/CoordinatorExtensions.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/CoordinatorExtensions.cs index 30b848e..16ff99e 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/CoordinatorExtensions.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/CoordinatorExtensions.cs @@ -24,7 +24,7 @@ public static class CoordinatorExtensions return null; } return new WabiSabiController(s.IdempotencyRequestCache, s.WabiSabiCoordinator.Arena, - s.WabiSabiCoordinator.CoinJoinFeeRateStatStore, s.WabiSabiCoordinator.AffiliationManager); + s.WabiSabiCoordinator.CoinJoinFeeRateStatStore); }); services.AddHostedService((sp) => sp.GetRequiredService()); diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/Filters/ExceptionTranslateAttribute.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/Filters/ExceptionTranslateAttribute.cs index b5c205d..1a84b7e 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/Filters/ExceptionTranslateAttribute.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/Filters/ExceptionTranslateAttribute.cs @@ -6,7 +6,6 @@ using Microsoft.Extensions.Logging; using Newtonsoft.Json; using NLog; using WabiSabi.Crypto; -using WalletWasabi.Affiliation; using WalletWasabi.WabiSabi; using WalletWasabi.WabiSabi.Backend.Models; using WalletWasabi.WabiSabi.Models; @@ -43,14 +42,6 @@ public class ExceptionTranslateAttribute : ExceptionFilterAttribute { StatusCode = (int) HttpStatusCode.InternalServerError }, - AffiliationException e => new JsonResult(new Error( - Type: AffiliationConstants.RequestSecrecyViolationType, - ErrorCode: "undefined", - Description: e.Message, - ExceptionData: EmptyExceptionData.Instance), serializerSettings) - { - StatusCode = (int) HttpStatusCode.InternalServerError - }, _ => new StatusCodeResult((int) HttpStatusCode.InternalServerError) }; } diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabiSabiController.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabiSabiController.cs index 4ead252..f9fc6f8 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabiSabiController.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabiSabiController.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; -using WalletWasabi.Affiliation; using WalletWasabi.Backend.Filters; using WalletWasabi.Cache; using WalletWasabi.WabiSabi.Backend.PostRequests; @@ -24,27 +23,24 @@ namespace WalletWasabi.Backend.Controllers; [Produces("application/json")] public class WabiSabiController : ControllerBase, IWabiSabiApiRequestHandler { - public WabiSabiController(IdempotencyRequestCache idempotencyRequestCache, Arena arena, CoinJoinFeeRateStatStore coinJoinFeeRateStatStore, AffiliationManager affiliationManager) + public WabiSabiController(IdempotencyRequestCache idempotencyRequestCache, Arena arena, CoinJoinFeeRateStatStore coinJoinFeeRateStatStore) { IdempotencyRequestCache = idempotencyRequestCache; Arena = arena; CoinJoinFeeRateStatStore = coinJoinFeeRateStatStore; - AffiliationManager = affiliationManager; } private static TimeSpan RequestTimeout { get; } = TimeSpan.FromMinutes(5); private IdempotencyRequestCache IdempotencyRequestCache { get; } private Arena Arena { get; } private CoinJoinFeeRateStatStore CoinJoinFeeRateStatStore { get; } - private AffiliationManager AffiliationManager { get; } [HttpPost("status")] public async Task GetStatusAsync(RoundStateRequest request, CancellationToken cancellationToken) { var response = await Arena.GetStatusAsync(request, cancellationToken); var medians = CoinJoinFeeRateStatStore.GetDefaultMedians(); - var affiliateInformation = AffiliationManager.GetAffiliateInformation(); - var ret = new RoundStateResponse(response.RoundStates, medians, affiliateInformation); + var ret = new RoundStateResponse(response.RoundStates, medians); return ret; } diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabisabiCoordinatorService.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabisabiCoordinatorService.cs index 779b23c..ec6c0eb 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabisabiCoordinatorService.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabisabiCoordinatorService.cs @@ -31,7 +31,6 @@ using WalletWasabi.Services; using WalletWasabi.Tor.Socks5.Pool.Circuits; using WalletWasabi.WabiSabi; using WalletWasabi.WabiSabi.Backend; -using WalletWasabi.WabiSabi.Backend.Rounds.CoinJoinStorage; using WalletWasabi.WabiSabi.Backend.Statistics; using WalletWasabi.WabiSabi.Client; using WalletWasabi.WabiSabi.Models; @@ -230,12 +229,10 @@ public class WabisabiCoordinatorService : PeriodicRunner var network = _networkProvider.GetNetwork("BTC"); var coordinatorParameters = new CoordinatorParameters(Path.Combine(_dataDirectories.Value.DataDir, "Plugins", "Coinjoin")); - var coinJoinIdStore = - CoinJoinIdStore.Create( coordinatorParameters.CoinJoinIdStoreFilePath); var coinJoinScriptStore = CoinJoinScriptStore.LoadFromFile(coordinatorParameters.CoinJoinScriptStoreFilePath); var rpc = new BtcPayRpcClient(_feeProviderFactory.CreateFeeProvider(network),explorerClient.RPCClient, _memoryCache, explorerClient); - WabiSabiCoordinator = new WabiSabiCoordinator(coordinatorParameters, rpc, coinJoinIdStore, coinJoinScriptStore, + WabiSabiCoordinator = new WabiSabiCoordinator(coordinatorParameters, rpc, coinJoinScriptStore, _httpClientFactory, _coordinatorScriptResolver); HostedServices.Register(() => WabiSabiCoordinator, "WabiSabi Coordinator"); @@ -267,8 +264,8 @@ public class WabisabiCoordinatorService : PeriodicRunner { instance.WasabiCoordinatorStatusFetcher.OverrideConnected = null; } - - var coinjoinConfig = new CoinJoinConfiguration(WabiSabiCoordinator.Config.CoordinatorIdentifier, 10m, 100m); + + var coinjoinConfig = new CoinJoinConfiguration(WabiSabiCoordinator.Config.CoordinatorIdentifier,150m, WabiSabiCoordinator.Config.MinInputCountByRound, false); _instanceManager.AddCoordinator("Local Coordinator", "local", _ => null, cachedSettings.TermsConditions, diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml index 5a38b34..3f3f28a 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml @@ -379,7 +379,7 @@ Fee charged @{ - var fee = $"{roundParameters.CoordinationFeeRate.Rate * 100}% + Free remixing {(roundParameters.CoordinationFeeRate.PlebsDontPayThreshold <= 0 ? string.Empty : $"+ Free under {roundParameters.CoordinationFeeRate.PlebsDontPayThreshold.ToDecimal(MoneyUnit.BTC)} BTC")}"; + var fee = $"{roundParameters.CoordinationFeeRate.Rate * 100}%"; } @(fee) @@ -450,7 +450,6 @@ @if (Model.Settings[index].RoundWhenEnabled is not null) { - } diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiService.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiService.cs index e71bfa3..5a47fea 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiService.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiService.cs @@ -50,15 +50,6 @@ namespace BTCPayServer.Plugins.Wabisabi 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"; - } - }); - await EnablePayoutProcessorBasedOnSettings(storeId, res); return res; @@ -126,8 +117,6 @@ namespace BTCPayServer.Plugins.Wabisabi ? new LastCoordinatorRoundConfig() { CoordinationFeeRate = roundParameters.CoordinationFeeRate.Rate, - PlebsDontPayThreshold = roundParameters.CoordinationFeeRate - .PlebsDontPayThreshold.Satoshi.ToString(), MinInputCountByRound = roundParameters.MinInputCountByRound, } : null; diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreController.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreController.cs index 58596a7..b85aea2 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreController.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreController.cs @@ -245,7 +245,7 @@ namespace BTCPayServer.Plugins.Wabisabi { coordSettings.DiscoveredCoordinators.Add(viewModel); await _wabisabiCoordinatorService.UpdateSettings(coordSettings); - var config = new CoinJoinConfiguration(); + var config = new CoinJoinConfiguration("CoordinatorIdentifier",150m, 1, false); _instanceManager.AddCoordinator(viewModel.Name, viewModel.Name, provider => viewModel.Uri, null,viewModel.Description, config); TempData["SuccessMessage"] = $"Coordinator {viewModel.Name } added and started"; diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreSettings.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreSettings.cs index e81435e..37f868a 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreSettings.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/WabisabiStoreSettings.cs @@ -84,9 +84,6 @@ public class LastCoordinatorRoundConfig { public decimal CoordinationFeeRate { get; set; } - public string PlebsDontPayThreshold { get; set; } - [JsonIgnore] - public Money PlebsDontPayThresholdM => Money.Parse(PlebsDontPayThreshold); public int MinInputCountByRound { get; set; } } diff --git a/submodules/walletwasabi b/submodules/walletwasabi index 3f52c3f..e302e37 160000 --- a/submodules/walletwasabi +++ b/submodules/walletwasabi @@ -1 +1 @@ -Subproject commit 3f52c3f7b7da409bdb217977dbc3a77b892ff5d7 +Subproject commit e302e37c746c86810c13c67ec2f92ecf818d1be6