Fix serialization loop
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/ConfigTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/ConfigTests.cs
@@ -91,6 +91,14 @@ public class ConfigTests
Assert.Contains(lines, x => x.Contains("\"ReleaseUtxoFromPrisonAfter\": \"0d 3h 0m 0s\"", StringComparison.Ordinal));
}
+ [Fact]
+ public async Task XXXXXChecksConfigChangesAsync()
+ {
+ WabiSabiConfig configChanger = new("./conf.txt");
+ configChanger.LoadOrCreateDefaultFile();
+ configChanger.LoadFile();
+ }
+
[Fact]
public async Task ChecksConfigChangesAsync()
{

MODIFY
WalletWasabi/Bases/ConfigBase.cs
WalletWasabi/Bases/ConfigBase.cs
@@ -98,8 +98,9 @@ public abstract class ConfigBase : NotifyPropertyChangedBase, IConfig
/// <inheritdoc />
public bool AreDeepEqual(object otherConfig)
{
- var currentConfig = JObject.FromObject(this);
- var otherConfigJson = JObject.FromObject(otherConfig);
+ var serializer = JsonSerializer.Create(JsonSerializationOptions.Default.Settings);
+ var currentConfig = JObject.FromObject(this, serializer);
+ var otherConfigJson = JObject.FromObject(otherConfig, serializer);
return JToken.DeepEquals(otherConfigJson, currentConfig);
}
@@ -108,7 +109,7 @@ public abstract class ConfigBase : NotifyPropertyChangedBase, IConfig
{
AssertFilePathSet();
- string jsonString = JsonConvert.SerializeObject(this, Formatting.Indented);
+ string jsonString = JsonConvert.SerializeObject(this, Formatting.Indented, JsonSerializationOptions.Default.Settings);
File.WriteAllText(FilePath, jsonString, Encoding.UTF8);
}

MODIFY
WalletWasabi/WabiSabi/Backend/WabiSabiConfig.cs
WalletWasabi/WabiSabi/Backend/WabiSabiConfig.cs
@@ -94,6 +94,7 @@ public class WabiSabiConfig : ConfigBase
/// <summary>
/// If money comes to the blame script, then either an attacker lost money or there's a client bug.
/// </summary>
+ [JsonIgnore]
public Script BlameScript => DeriveCoordinatorScript(0);
public Script GetNextCleanCoordinatorScript() => DeriveCoordinatorScript(CoordinatorExtPubKeyCurrentDepth);

MODIFY
WalletWasabi/WabiSabi/Models/Serialization/JsonSerializationOptions.cs
WalletWasabi/WabiSabi/Models/Serialization/JsonSerializationOptions.cs
@@ -2,6 +2,7 @@ using System.Collections.Generic;
using Newtonsoft.Json;
using WalletWasabi.JsonConverters;
using WalletWasabi.JsonConverters.Bitcoin;
+using WalletWasabi.JsonConverters.Timing;
using WalletWasabi.WabiSabi.Crypto.Serialization;
namespace WalletWasabi.WabiSabi.Models.Serialization;
@@ -22,7 +23,9 @@ public class JsonSerializationOptions
new FeeRateJsonConverter(),
new MoneySatoshiJsonConverter(),
new Uint256JsonConverter(),
- new MultipartyTransactionStateJsonConverter()
+ new MultipartyTransactionStateJsonConverter(),
+ new ExtPubKeyJsonConverter(),
+ new TimeSpanJsonConverter(),
}
};
public static readonly JsonSerializationOptions Default = new();

Fix serialization loop