Remove `CoordinationFeeRate` json converter
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PhaseStepping/StepOutputRegistrationTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PhaseStepping/StepOutputRegistrationTests.cs
@@ -93,7 +93,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PhaseStepping
Assert.Equal(Phase.TransactionSigning, round.Phase);
var tx = round.Assert<SigningState>().CreateTransaction();
Assert.Equal(2, tx.Inputs.Count);
- Assert.Equal(2, tx.Outputs.Count);
+ Assert.Equal(2 + 1, tx.Outputs.Count); // +1 for the coordinator fee
Assert.Contains(cfg.BlameScript, tx.Outputs.Select(x => x.ScriptPubKey));
await arena.StopAsync(CancellationToken.None);

MODIFY
WalletWasabi/Bases/ConfigBase.cs
WalletWasabi/Bases/ConfigBase.cs
@@ -5,6 +5,7 @@ using System.Text;
using WalletWasabi.Helpers;
using WalletWasabi.Interfaces;
using WalletWasabi.Logging;
+using WalletWasabi.WabiSabi.Models.Serialization;
namespace WalletWasabi.Bases
{
@@ -44,7 +45,7 @@ namespace WalletWasabi.Bases
string jsonString = File.ReadAllText(FilePath, Encoding.UTF8);
var newConfigObject = Activator.CreateInstance(GetType());
- JsonConvert.PopulateObject(jsonString, newConfigObject);
+ JsonConvert.PopulateObject(jsonString, newConfigObject, JsonSerializationOptions.Default.Settings);
return !AreDeepEqual(newConfigObject);
}
@@ -80,7 +81,7 @@ namespace WalletWasabi.Bases
{
var jsonString = File.ReadAllText(FilePath, Encoding.UTF8);
- JsonConvert.PopulateObject(jsonString, this);
+ JsonConvert.PopulateObject(jsonString, this, JsonSerializationOptions.Default.Settings);
if (TryEnsureBackwardsCompatibility(jsonString))
{

DELETE
WalletWasabi/JsonConverters/CoordinationFeeRateJsonConverter.cs
-using NBitcoin;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using WalletWasabi.WabiSabi.Models;
-
-namespace WalletWasabi.JsonConverters
-{
- public class CoordinationFeeRateJsonConverter : JsonConverter<CoordinationFeeRate>
- {
- /// <inheritdoc />
- public override CoordinationFeeRate ReadJson(JsonReader reader, Type objectType, CoordinationFeeRate existingValue, bool hasExistingValue, JsonSerializer serializer)
- {
- JObject item = JObject.Load(reader);
-
- var rate = item.GetValue("Rate", StringComparison.OrdinalIgnoreCase)?.Value<decimal>() ?? throw new JsonSerializationException("Rate is null.");
- var plebsDontPayThreshold = item.GetValue("PlebsDontPayThreshold", StringComparison.OrdinalIgnoreCase)?.Value<long>() ?? throw new JsonSerializationException("PlebsDontPayThreshold is null.");
- return new CoordinationFeeRate(rate, Money.Satoshis(plebsDontPayThreshold));
- }
-
- /// <inheritdoc />
- public override void WriteJson(JsonWriter writer, CoordinationFeeRate value, JsonSerializer serializer)
- {
- writer.WriteStartObject();
- writer.WritePropertyName("Rate");
- writer.WriteValue(value.Rate);
- writer.WritePropertyName("PlebsDontPayThreshold");
- writer.WriteValue(value.PlebsDontPayThreshold);
- writer.WriteEndObject();
- }
- }
-}

MODIFY
WalletWasabi/WabiSabi/Backend/WabiSabiConfig.cs
WalletWasabi/WabiSabi/Backend/WabiSabiConfig.cs
@@ -27,7 +27,6 @@ namespace WalletWasabi.WabiSabi.Backend
[DefaultValueTimeSpan("0d 3h 0m 0s")]
[JsonProperty(PropertyName = "ReleaseUtxoFromPrisonAfter", DefaultValueHandling = DefaultValueHandling.Populate)]
- [JsonConverter(typeof(TimeSpanJsonConverter))]
public TimeSpan ReleaseUtxoFromPrisonAfter { get; set; } = TimeSpan.FromHours(3);
[DefaultValueMoneyBtc("0.00005")]
@@ -49,32 +48,26 @@ namespace WalletWasabi.WabiSabi.Backend
[DefaultValueTimeSpan("0d 1h 0m 0s")]
[JsonProperty(PropertyName = "StandardInputRegistrationTimeout", DefaultValueHandling = DefaultValueHandling.Populate)]
- [JsonConverter(typeof(TimeSpanJsonConverter))]
public TimeSpan StandardInputRegistrationTimeout { get; set; } = TimeSpan.FromHours(1);
[DefaultValueTimeSpan("0d 0h 3m 0s")]
[JsonProperty(PropertyName = "BlameInputRegistrationTimeout", DefaultValueHandling = DefaultValueHandling.Populate)]
- [JsonConverter(typeof(TimeSpanJsonConverter))]
public TimeSpan BlameInputRegistrationTimeout { get; set; } = TimeSpan.FromMinutes(3);
[DefaultValueTimeSpan("0d 0h 1m 0s")]
[JsonProperty(PropertyName = "ConnectionConfirmationTimeout", DefaultValueHandling = DefaultValueHandling.Populate)]
- [JsonConverter(typeof(TimeSpanJsonConverter))]
public TimeSpan ConnectionConfirmationTimeout { get; set; } = TimeSpan.FromMinutes(1);
[DefaultValueTimeSpan("0d 0h 1m 0s")]
[JsonProperty(PropertyName = "OutputRegistrationTimeout", DefaultValueHandling = DefaultValueHandling.Populate)]
- [JsonConverter(typeof(TimeSpanJsonConverter))]
public TimeSpan OutputRegistrationTimeout { get; set; } = TimeSpan.FromMinutes(1);
[DefaultValueTimeSpan("0d 0h 1m 0s")]
[JsonProperty(PropertyName = "TransactionSigningTimeout", DefaultValueHandling = DefaultValueHandling.Populate)]
- [JsonConverter(typeof(TimeSpanJsonConverter))]
public TimeSpan TransactionSigningTimeout { get; set; } = TimeSpan.FromMinutes(1);
[DefaultValueTimeSpan("0d 0h 5m 0s")]
[JsonProperty(PropertyName = "RoundExpiryTimeout", DefaultValueHandling = DefaultValueHandling.Populate)]
- [JsonConverter(typeof(TimeSpanJsonConverter))]
public TimeSpan RoundExpiryTimeout { get; set; } = TimeSpan.FromMinutes(5);
[DefaultValue(100)]
@@ -89,15 +82,9 @@ namespace WalletWasabi.WabiSabi.Backend
[DefaultValueCoordinationFeeRate(0.003, 0.01)]
[JsonProperty(PropertyName = "CoordinationFeeRate", DefaultValueHandling = DefaultValueHandling.Populate)]
- [JsonConverter(typeof(CoordinationFeeRateJsonConverter))]
public CoordinationFeeRate CoordinationFeeRate { get; set; } = new CoordinationFeeRate(0.003m, Money.Coins(0.01m));
- [DefaultValue(0.01)]
- [JsonProperty(PropertyName = "PlebsDontPayThreshold", DefaultValueHandling = DefaultValueHandling.Populate)]
- public double PlebsDontPayThreshold { get; set; } = 0.01;
-
[JsonProperty(PropertyName = "CoordinatorExtPubKey")]
- [JsonConverter(typeof(ExtPubKeyJsonConverter))]
public ExtPubKey CoordinatorExtPubKey { get; } = Constants.WabiSabiFallBackCoordinatorExtPubKey;
[DefaultValue(1)]

MODIFY
WalletWasabi/WabiSabi/Models/Serialization/JsonSerializationOptions.cs
WalletWasabi/WabiSabi/Models/Serialization/JsonSerializationOptions.cs
@@ -20,7 +20,6 @@ namespace WalletWasabi.WabiSabi.Models.Serialization
new OwnershipProofJsonConverter(),
new NetworkJsonConverter(),
new FeeRateJsonConverter(),
- new CoordinationFeeRateJsonConverter(),
new MoneySatoshiJsonConverter(),
new Uint256JsonConverter(),
new MultipartyTransactionStateJsonConverter()

Remove `CoordinationFeeRate` json converter