diff --git a/BTCPayServerPlugins.sln.DotSettings.user b/BTCPayServerPlugins.sln.DotSettings.user index 053c8d0..7e04d32 100644 --- a/BTCPayServerPlugins.sln.DotSettings.user +++ b/BTCPayServerPlugins.sln.DotSettings.user @@ -5,9 +5,15 @@ ExplicitlyExcluded ForceIncluded ForceIncluded - ExplicitlyExcluded + ForceIncluded ExplicitlyExcluded ForceIncluded + <AssemblyExplorer> + <Assembly Path="C:\Git\BTCPayServerPlugins\Plugins\BTCPayServer.Plugins.NIP05\bin\Debug\net8.0\NNostr.Client.dll" /> +</AssemblyExplorer> + C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe + C:\Program Files\dotnet\dotnet.exe + 1114112 <SessionState ContinuousTestingMode="0" IsActive="True" Name="EnsureNewLightningInvoiceOnPartialPayment" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> <TestAncestor> <TestId>xUnit::4146B6DF-7BEE-4BD0-B6B1-77E7630A1B81::net8.0::BTCPayServer.Tests.UnitTest1.EnsureNewLightningInvoiceOnPartialPayment</TestId> diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs index 99ed025..24c8a4f 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayCoinjoinCoinSelector.cs @@ -53,8 +53,7 @@ SmartCoin[] FilterCoinsMore(IEnumerable coins) .Where(coin => roundParameters.AllowedInputAmounts.Contains(coin.Amount)) .Where(coin => { - var effV = coin.EffectiveValue(roundParameters.MiningFeeRate, - roundParameters.CoordinationFeeRate); + var effV = coin.EffectiveValue(roundParameters.MiningFeeRate); var percentageLeft = (effV.ToDecimal(MoneyUnit.BTC) / coin.Amount.ToDecimal(MoneyUnit.BTC)); // filter out low value coins where 50% of the value would be eaten up by fees return effV > Money.Zero && percentageLeft >= 0.5m; @@ -283,8 +282,7 @@ SmartCoin[] FilterCoinsMore(IEnumerable coins) //attempt to shift coins that comes from the same tx AND also attempt to shift coins based on percentage probability var remainingCoins = SlightlyShiftOrder(RandomizeCoins( coins.OrderBy(coin => coin.CoinColor(_wallet)).ThenByDescending(x => - x.EffectiveValue(utxoSelectionParameters.MiningFeeRate, - utxoSelectionParameters.CoordinationFeeRate)) + x.EffectiveValue(utxoSelectionParameters.MiningFeeRate)) .ToList(), liquidityClue), 10); var remainingPendingPayments = new List(pendingPayments); var solution = new SubsetSolution(remainingPendingPayments.Count, _wallet, @@ -487,8 +485,7 @@ public class SubsetSolution public List Coins { get; set; } = new(); public List HandledPayments { get; set; } = new(); - public decimal TotalValue => Coins.Sum(coin => - coin.EffectiveValue(_utxoSelectionParameters.MiningFeeRate, _utxoSelectionParameters.CoordinationFeeRate) + public decimal TotalValue => Coins.Sum(coin => coin.EffectiveValue(_utxoSelectionParameters.MiningFeeRate) .ToDecimal(MoneyUnit.BTC)); public Dictionary SortedCoins => diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj index 57586ed..50764f9 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayServer.Plugins.Wabisabi.csproj @@ -13,7 +13,7 @@ Coinjoin Allows you to integrate your btcpayserver store with coinjoins. - 1.0.92 + 1.0.93 true diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/SettingsCoinPrison.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/SettingsCoinPrison.cs index 278ed50..b33e296 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/SettingsCoinPrison.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/SettingsCoinPrison.cs @@ -4,6 +4,7 @@ using System.IO; using System.Threading.Tasks; using BTCPayServer.Services; using Microsoft.Extensions.Logging; +using NBitcoin; using Newtonsoft.Json; using NLog; using WalletWasabi.WabiSabi.Client.Banning; @@ -17,7 +18,8 @@ public class SettingsCoinPrison : CoinPrison private readonly SettingsRepository _settingsRepository; private readonly string _coordinatorName; - public SettingsCoinPrison(SettingsRepository settingsRepository, string coordinatorName) : base(null) + public SettingsCoinPrison(SettingsRepository settingsRepository, string coordinatorName, + Dictionary bannedCoins) : base(null, bannedCoins) { _settingsRepository = settingsRepository; _coordinatorName = coordinatorName; @@ -25,29 +27,30 @@ public class SettingsCoinPrison : CoinPrison protected override void ToFile() { - var json = JsonConvert.SerializeObject(BannedCoins, Formatting.Indented); + var json = JsonConvert.SerializeObject(_bannedCoins, Formatting.Indented); _settingsRepository.UpdateSetting(json, "wabisabi_" + _coordinatorName + "_bannedcoins").GetAwaiter().GetResult(); } public static async Task CreateFromCoordinatorName(SettingsRepository settingsRepository, string coordinatorName, ILogger logger) { - HashSet prisonedCoinRecords = new(); + Dictionary prisonedCoinRecords = new(); try { var data = await settingsRepository.GetSettingAsync("wabisabi_" + coordinatorName + "_bannedcoins"); if (string.IsNullOrWhiteSpace(data)) { logger.LogDebug("Prisoned coins file is empty."); - return new(settingsRepository, coordinatorName); + return new(settingsRepository, coordinatorName, new()); } - prisonedCoinRecords = JsonConvert.DeserializeObject>(data) + prisonedCoinRecords = JsonConvert.DeserializeObject>(data) ?? throw new InvalidDataException("Prisoned coins file is corrupted."); } catch (Exception exc) { logger.LogError($"There was an error during loading {nameof(SettingsCoinPrison)}. Ignoring corrupt data.", exc); } - return new(settingsRepository, coordinatorName){ BannedCoins = prisonedCoinRecords }; + + return new(settingsRepository, coordinatorName, prisonedCoinRecords); } } \ No newline at end of file diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/Shared/Wabisabi/WabisabiDashboard.cshtml b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/Shared/Wabisabi/WabisabiDashboard.cshtml index 433056b..06dc5ed 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/Shared/Wabisabi/WabisabiDashboard.cshtml +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/Shared/Wabisabi/WabisabiDashboard.cshtml @@ -416,7 +416,7 @@ updateInProgressAnimation(myChart); @{ if (coordinator.CoinPrison is not null) { - var bannedCoins = coins.Where(coin => coordinator.CoinPrison.TryGetOrRemoveBannedCoin(coin, out _)); + var bannedCoins = coins.Where(coin => coordinator.CoinPrison.IsBanned(coin.Outpoint)).ToArray(); @if (bannedCoins.Any()) {
@bannedCoins.Count() banned coins(for disrupting rounds)
diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/Spend.cshtml b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/Spend.cshtml index cb39b7f..88efd97 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/Spend.cshtml +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/Spend.cshtml @@ -1,11 +1,5 @@ @using BTCPayServer.Plugins.Wabisabi -@using BTCPayServer.Abstractions.Extensions @using BTCPayServer.Abstractions.Contracts -@using BTCPayServer.Security -@using NBitcoin -@using System.Security.Claims -@using BTCPayServer -@using BTCPayServer.Common @model WabisabiStoreController.SpendViewModel @inject IScopeProvider _scopeProvider @inject WalletProvider WalletProvider diff --git a/submodules/walletwasabi b/submodules/walletwasabi index e302e37..0b02a5c 160000 --- a/submodules/walletwasabi +++ b/submodules/walletwasabi @@ -1 +1 @@ -Subproject commit e302e37c746c86810c13c67ec2f92ecf818d1be6 +Subproject commit 0b02a5c36ac3fef41f259d13a71320e0e4ea29f6