mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 07:34:24 +01:00
upd wb
This commit is contained in:
@@ -5,9 +5,15 @@
|
|||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003ABlockchain_002Fd_003ATransactionOutputs_002Ff_003ASmartCoin_002Ecs/@EntryIndexedValue">ExplicitlyExcluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003ABlockchain_002Fd_003ATransactionOutputs_002Ff_003ASmartCoin_002Ecs/@EntryIndexedValue">ExplicitlyExcluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003AWabiSabi_002Fd_003AClient_002Ff_003ACoinJoinClient_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003AWabiSabi_002Fd_003AClient_002Ff_003ACoinJoinClient_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003AWabiSabi_002Fd_003AClient_002Ff_003ACoinJoinManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003AWabiSabi_002Fd_003AClient_002Ff_003ACoinJoinManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003AWabiSabi_002Fd_003AClient_002Ff_003ACoinJoinTracker_002Ecs/@EntryIndexedValue">ExplicitlyExcluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003AWabiSabi_002Fd_003AClient_002Ff_003ACoinJoinTracker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003AWabiSabi_002Fd_003AClient_002Ff_003ACoinJoinTrackerFactory_002Ecs/@EntryIndexedValue">ExplicitlyExcluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003AWabiSabi_002Fd_003AClient_002Ff_003ACoinJoinTrackerFactory_002Ecs/@EntryIndexedValue">ExplicitlyExcluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003AWallets_002Ff_003AWallet_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D1D1116C_002D38F9_002D4EA3_002DAC65_002DA75FEA82E5C8_002Fd_003AWallets_002Ff_003AWallet_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||||
|
<Assembly Path="C:\Git\BTCPayServerPlugins\Plugins\BTCPayServer.Plugins.NIP05\bin\Debug\net8.0\NNostr.Client.dll" />
|
||||||
|
</AssemblyExplorer></s:String>
|
||||||
|
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe</s:String>
|
||||||
|
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/DotNetCliExePath/@EntryValue">C:\Program Files\dotnet\dotnet.exe</s:String>
|
||||||
|
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">1114112</s:Int64>
|
||||||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=cedf4985_002D652b_002D4803_002D9af5_002D7e2c856d885a/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="EnsureNewLightningInvoiceOnPartialPayment" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=cedf4985_002D652b_002D4803_002D9af5_002D7e2c856d885a/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="EnsureNewLightningInvoiceOnPartialPayment" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||||
<TestAncestor>
|
<TestAncestor>
|
||||||
<TestId>xUnit::4146B6DF-7BEE-4BD0-B6B1-77E7630A1B81::net8.0::BTCPayServer.Tests.UnitTest1.EnsureNewLightningInvoiceOnPartialPayment</TestId>
|
<TestId>xUnit::4146B6DF-7BEE-4BD0-B6B1-77E7630A1B81::net8.0::BTCPayServer.Tests.UnitTest1.EnsureNewLightningInvoiceOnPartialPayment</TestId>
|
||||||
|
|||||||
@@ -53,8 +53,7 @@ SmartCoin[] FilterCoinsMore(IEnumerable<SmartCoin> coins)
|
|||||||
.Where(coin => roundParameters.AllowedInputAmounts.Contains(coin.Amount))
|
.Where(coin => roundParameters.AllowedInputAmounts.Contains(coin.Amount))
|
||||||
.Where(coin =>
|
.Where(coin =>
|
||||||
{
|
{
|
||||||
var effV = coin.EffectiveValue(roundParameters.MiningFeeRate,
|
var effV = coin.EffectiveValue(roundParameters.MiningFeeRate);
|
||||||
roundParameters.CoordinationFeeRate);
|
|
||||||
var percentageLeft = (effV.ToDecimal(MoneyUnit.BTC) / coin.Amount.ToDecimal(MoneyUnit.BTC));
|
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
|
// filter out low value coins where 50% of the value would be eaten up by fees
|
||||||
return effV > Money.Zero && percentageLeft >= 0.5m;
|
return effV > Money.Zero && percentageLeft >= 0.5m;
|
||||||
@@ -283,8 +282,7 @@ SmartCoin[] FilterCoinsMore(IEnumerable<SmartCoin> coins)
|
|||||||
//attempt to shift coins that comes from the same tx AND also attempt to shift coins based on percentage probability
|
//attempt to shift coins that comes from the same tx AND also attempt to shift coins based on percentage probability
|
||||||
var remainingCoins = SlightlyShiftOrder(RandomizeCoins(
|
var remainingCoins = SlightlyShiftOrder(RandomizeCoins(
|
||||||
coins.OrderBy(coin => coin.CoinColor(_wallet)).ThenByDescending(x =>
|
coins.OrderBy(coin => coin.CoinColor(_wallet)).ThenByDescending(x =>
|
||||||
x.EffectiveValue(utxoSelectionParameters.MiningFeeRate,
|
x.EffectiveValue(utxoSelectionParameters.MiningFeeRate))
|
||||||
utxoSelectionParameters.CoordinationFeeRate))
|
|
||||||
.ToList(), liquidityClue), 10);
|
.ToList(), liquidityClue), 10);
|
||||||
var remainingPendingPayments = new List<PendingPayment>(pendingPayments);
|
var remainingPendingPayments = new List<PendingPayment>(pendingPayments);
|
||||||
var solution = new SubsetSolution(remainingPendingPayments.Count, _wallet,
|
var solution = new SubsetSolution(remainingPendingPayments.Count, _wallet,
|
||||||
@@ -487,8 +485,7 @@ public class SubsetSolution
|
|||||||
public List<SmartCoin> Coins { get; set; } = new();
|
public List<SmartCoin> Coins { get; set; } = new();
|
||||||
public List<PendingPayment> HandledPayments { get; set; } = new();
|
public List<PendingPayment> HandledPayments { get; set; } = new();
|
||||||
|
|
||||||
public decimal TotalValue => Coins.Sum(coin =>
|
public decimal TotalValue => Coins.Sum(coin => coin.EffectiveValue(_utxoSelectionParameters.MiningFeeRate)
|
||||||
coin.EffectiveValue(_utxoSelectionParameters.MiningFeeRate, _utxoSelectionParameters.CoordinationFeeRate)
|
|
||||||
.ToDecimal(MoneyUnit.BTC));
|
.ToDecimal(MoneyUnit.BTC));
|
||||||
|
|
||||||
public Dictionary<AnonsetType, SmartCoin[]> SortedCoins =>
|
public Dictionary<AnonsetType, SmartCoin[]> SortedCoins =>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Product>Coinjoin</Product>
|
<Product>Coinjoin</Product>
|
||||||
<Description>Allows you to integrate your btcpayserver store with coinjoins.</Description>
|
<Description>Allows you to integrate your btcpayserver store with coinjoins.</Description>
|
||||||
<Version>1.0.92</Version>
|
<Version>1.0.93</Version>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BTCPayServer.Services;
|
using BTCPayServer.Services;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using NBitcoin;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NLog;
|
using NLog;
|
||||||
using WalletWasabi.WabiSabi.Client.Banning;
|
using WalletWasabi.WabiSabi.Client.Banning;
|
||||||
@@ -17,7 +18,8 @@ public class SettingsCoinPrison : CoinPrison
|
|||||||
private readonly SettingsRepository _settingsRepository;
|
private readonly SettingsRepository _settingsRepository;
|
||||||
private readonly string _coordinatorName;
|
private readonly string _coordinatorName;
|
||||||
|
|
||||||
public SettingsCoinPrison(SettingsRepository settingsRepository, string coordinatorName) : base(null)
|
public SettingsCoinPrison(SettingsRepository settingsRepository, string coordinatorName,
|
||||||
|
Dictionary<OutPoint, PrisonedCoinRecord> bannedCoins) : base(null, bannedCoins)
|
||||||
{
|
{
|
||||||
_settingsRepository = settingsRepository;
|
_settingsRepository = settingsRepository;
|
||||||
_coordinatorName = coordinatorName;
|
_coordinatorName = coordinatorName;
|
||||||
@@ -25,29 +27,30 @@ public class SettingsCoinPrison : CoinPrison
|
|||||||
|
|
||||||
protected override void ToFile()
|
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();
|
_settingsRepository.UpdateSetting(json, "wabisabi_" + _coordinatorName + "_bannedcoins").GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<SettingsCoinPrison> CreateFromCoordinatorName(SettingsRepository settingsRepository,
|
public static async Task<SettingsCoinPrison> CreateFromCoordinatorName(SettingsRepository settingsRepository,
|
||||||
string coordinatorName, ILogger logger)
|
string coordinatorName, ILogger logger)
|
||||||
{
|
{
|
||||||
HashSet<PrisonedCoinRecord> prisonedCoinRecords = new();
|
Dictionary<OutPoint, PrisonedCoinRecord> prisonedCoinRecords = new();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var data = await settingsRepository.GetSettingAsync<string>("wabisabi_" + coordinatorName + "_bannedcoins");
|
var data = await settingsRepository.GetSettingAsync<string>("wabisabi_" + coordinatorName + "_bannedcoins");
|
||||||
if (string.IsNullOrWhiteSpace(data))
|
if (string.IsNullOrWhiteSpace(data))
|
||||||
{
|
{
|
||||||
logger.LogDebug("Prisoned coins file is empty.");
|
logger.LogDebug("Prisoned coins file is empty.");
|
||||||
return new(settingsRepository, coordinatorName);
|
return new(settingsRepository, coordinatorName, new());
|
||||||
}
|
}
|
||||||
prisonedCoinRecords = JsonConvert.DeserializeObject<HashSet<PrisonedCoinRecord>>(data)
|
prisonedCoinRecords = JsonConvert.DeserializeObject<Dictionary<OutPoint, PrisonedCoinRecord>>(data)
|
||||||
?? throw new InvalidDataException("Prisoned coins file is corrupted.");
|
?? throw new InvalidDataException("Prisoned coins file is corrupted.");
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
catch (Exception exc)
|
||||||
{
|
{
|
||||||
logger.LogError($"There was an error during loading {nameof(SettingsCoinPrison)}. Ignoring corrupt data.", 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -416,7 +416,7 @@ updateInProgressAnimation(myChart);
|
|||||||
@{
|
@{
|
||||||
if (coordinator.CoinPrison is not null)
|
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())
|
@if (bannedCoins.Any())
|
||||||
{
|
{
|
||||||
<div class="text-muted">@bannedCoins.Count() banned coins(for disrupting rounds)</div>
|
<div class="text-muted">@bannedCoins.Count() banned coins(for disrupting rounds)</div>
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
@using BTCPayServer.Plugins.Wabisabi
|
@using BTCPayServer.Plugins.Wabisabi
|
||||||
@using BTCPayServer.Abstractions.Extensions
|
|
||||||
@using BTCPayServer.Abstractions.Contracts
|
@using BTCPayServer.Abstractions.Contracts
|
||||||
@using BTCPayServer.Security
|
|
||||||
@using NBitcoin
|
|
||||||
@using System.Security.Claims
|
|
||||||
@using BTCPayServer
|
|
||||||
@using BTCPayServer.Common
|
|
||||||
@model WabisabiStoreController.SpendViewModel
|
@model WabisabiStoreController.SpendViewModel
|
||||||
@inject IScopeProvider _scopeProvider
|
@inject IScopeProvider _scopeProvider
|
||||||
@inject WalletProvider WalletProvider
|
@inject WalletProvider WalletProvider
|
||||||
|
|||||||
Submodule submodules/walletwasabi updated: e302e37c74...0b02a5c36a
Reference in New Issue
Block a user