fix round checker serialization issue

This commit is contained in:
Kukks
2023-02-27 18:30:22 +01:00
parent 5abc385789
commit 47faf9d178
4 changed files with 15 additions and 5 deletions

View File

@@ -13,7 +13,7 @@
<PropertyGroup>
<Product>Wabisabi Coinjoin</Product>
<Description>Allows you to integrate your btcpayserver store with coinjoins.</Description>
<Version>1.0.17</Version>
<Version>1.0.18</Version>
</PropertyGroup>
<!-- Plugin development properties -->

View File

@@ -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)

View File

@@ -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<WabisabiStoreSettings>(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,
};
}

View File

@@ -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; }
}