Remove BC code
MODIFY
WalletWasabi.Backend/Config.cs
WalletWasabi.Backend/Config.cs
using NBitcoin;
using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
using System.ComponentModel;
using System.Net;
using WalletWasabi.Bases;
using WalletWasabi.Exceptions;
using WalletWasabi.Helpers;
using WalletWasabi.JsonConverters;
-using WalletWasabi.Logging;
-using WalletWasabi.Userfacing;
namespace WalletWasabi.Backend;
@@ -117,68 +114,4 @@ public class Config : ConfigBase
throw new NotSupportedNetworkException(Network);
}
}
-
- protected override bool TryEnsureBackwardsCompatibility(string jsonString)
- {
- try
- {
- var jsObject = JsonConvert.DeserializeObject<JObject>(jsonString);
-
- if (jsObject is null)
- {
- Logger.LogWarning("Failed to parse config JSON.");
- return false;
- }
-
- bool saveIt = false;
-
- var mainNetBitcoinCoreHost = jsObject.Value<string>("MainNetBitcoinCoreHost");
- var mainNetBitcoinCorePort = jsObject.Value<int?>("MainNetBitcoinCorePort");
- var testNetBitcoinCoreHost = jsObject.Value<string>("TestNetBitcoinCoreHost");
- var testNetBitcoinCorePort = jsObject.Value<int?>("TestNetBitcoinCorePort");
- var regTestBitcoinCoreHost = jsObject.Value<string>("RegTestBitcoinCoreHost");
- var regTestBitcoinCorePort = jsObject.Value<int?>("RegTestBitcoinCorePort");
-
- if (mainNetBitcoinCoreHost is { })
- {
- int port = mainNetBitcoinCorePort ?? Constants.DefaultMainNetBitcoinP2pPort;
-
- if (EndPointParser.TryParse(mainNetBitcoinCoreHost, port, out EndPoint? ep))
- {
- MainNetBitcoinP2pEndPoint = ep;
- saveIt = true;
- }
- }
-
- if (testNetBitcoinCoreHost is { })
- {
- int port = testNetBitcoinCorePort ?? Constants.DefaultTestNetBitcoinP2pPort;
-
- if (EndPointParser.TryParse(testNetBitcoinCoreHost, port, out EndPoint? ep))
- {
- TestNetBitcoinP2pEndPoint = ep;
- saveIt = true;
- }
- }
-
- if (regTestBitcoinCoreHost is { })
- {
- int port = regTestBitcoinCorePort ?? Constants.DefaultRegTestBitcoinP2pPort;
-
- if (EndPointParser.TryParse(regTestBitcoinCoreHost, port, out EndPoint? ep))
- {
- RegTestBitcoinP2pEndPoint = ep;
- saveIt = true;
- }
- }
-
- return saveIt;
- }
- catch (Exception ex)
- {
- Logger.LogWarning("Backwards compatibility couldn't be ensured.");
- Logger.LogInfo(ex);
- return false;
- }
- }
}

MODIFY
WalletWasabi.Fluent/Config.cs
WalletWasabi.Fluent/Config.cs
using NBitcoin;
using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
using System.ComponentModel;
using System.Net;
using WalletWasabi.Bases;
@@ -8,9 +7,7 @@ using WalletWasabi.Exceptions;
using WalletWasabi.Helpers;
using WalletWasabi.JsonConverters;
using WalletWasabi.JsonConverters.Bitcoin;
-using WalletWasabi.Logging;
using WalletWasabi.Models;
-using WalletWasabi.Userfacing;
namespace WalletWasabi.Fluent;
@@ -192,70 +189,4 @@ public class Config : ConfigBase
ServiceConfiguration = new ServiceConfiguration(GetBitcoinP2pEndPoint(), DustThreshold);
}
-
- protected override bool TryEnsureBackwardsCompatibility(string jsonString)
- {
- try
- {
- var jsObject = JsonConvert.DeserializeObject<JObject>(jsonString);
-
- if (jsObject is null)
- {
- Logger.LogWarning("Failed to parse config JSON.");
- return false;
- }
-
- bool saveIt = false;
-
- var torHost = jsObject.Value<string>("TorHost");
- var torSocks5Port = jsObject.Value<int?>("TorSocks5Port");
- var mainNetBitcoinCoreHost = jsObject.Value<string>("MainNetBitcoinCoreHost");
- var mainNetBitcoinCorePort = jsObject.Value<int?>("MainNetBitcoinCorePort");
- var testNetBitcoinCoreHost = jsObject.Value<string>("TestNetBitcoinCoreHost");
- var testNetBitcoinCorePort = jsObject.Value<int?>("TestNetBitcoinCorePort");
- var regTestBitcoinCoreHost = jsObject.Value<string>("RegTestBitcoinCoreHost");
- var regTestBitcoinCorePort = jsObject.Value<int?>("RegTestBitcoinCorePort");
-
- if (mainNetBitcoinCoreHost is { })
- {
- int port = mainNetBitcoinCorePort ?? Constants.DefaultMainNetBitcoinP2pPort;
-
- if (EndPointParser.TryParse(mainNetBitcoinCoreHost, port, out EndPoint? ep))
- {
- MainNetBitcoinP2pEndPoint = ep;
- saveIt = true;
- }
- }
-
- if (testNetBitcoinCoreHost is { })
- {
- int port = testNetBitcoinCorePort ?? Constants.DefaultTestNetBitcoinP2pPort;
-
- if (EndPointParser.TryParse(testNetBitcoinCoreHost, port, out EndPoint? ep))
- {
- TestNetBitcoinP2pEndPoint = ep;
- saveIt = true;
- }
- }
-
- if (regTestBitcoinCoreHost is { })
- {
- int port = regTestBitcoinCorePort ?? Constants.DefaultRegTestBitcoinP2pPort;
-
- if (EndPointParser.TryParse(regTestBitcoinCoreHost, port, out EndPoint? ep))
- {
- RegTestBitcoinP2pEndPoint = ep;
- saveIt = true;
- }
- }
-
- return saveIt;
- }
- catch (Exception ex)
- {
- Logger.LogWarning("Backwards compatibility couldn't be ensured.");
- Logger.LogInfo(ex);
- return false;
- }
- }
}

MODIFY
WalletWasabi/Bases/ConfigBase.cs
WalletWasabi/Bases/ConfigBase.cs
@@ -121,18 +121,11 @@ public abstract class ConfigBase : NotifyPropertyChangedBase, IConfig
}
}
- protected virtual bool TryEnsureBackwardsCompatibility(string jsonString) => true;
-
protected void LoadFileNoLock()
{
string jsonString = ReadFileNoLock();
JsonConvert.PopulateObject(jsonString, this, JsonSerializationOptions.Default.Settings);
-
- if (TryEnsureBackwardsCompatibility(jsonString))
- {
- ToFileNoLock();
- }
}
protected void ToFileNoLock()

Remove BC code