Overwrite old config with the new one
MODIFY
WalletWasabi.Gui/Config.cs
WalletWasabi.Gui/Config.cs
@@ -327,7 +327,7 @@ namespace WalletWasabi.Gui
string jsonString = await File.ReadAllTextAsync(FilePath, Encoding.UTF8);
var res = JsonConvert.DeserializeObject<JObject>(jsonString);
-
+ bool saveIt = false;
if (res.TryGetValue("TorHost", out JToken jTorHost))
{
int port = Constants.DefaultTorSocksPort; //TODO: check this if it is OK
@@ -336,6 +336,7 @@ namespace WalletWasabi.Gui
port = int.Parse(jTorSocks5Port.ToString());
}
TorSocks5EndPoint = StringToEndPoint(jTorHost.ToString(), port);
+ saveIt = true;
}
if (res.TryGetValue("MainNetBitcoinCoreHost", out JToken jMainNetBitcoinCoreHost))
@@ -346,6 +347,7 @@ namespace WalletWasabi.Gui
port = int.Parse(jMainNetBitcoinCorePort.ToString());
}
MainNetBitcoinP2pEndPoint = StringToEndPoint(jMainNetBitcoinCoreHost.ToString(), port);
+ saveIt = true;
}
if (res.TryGetValue("TestNetBitcoinCoreHost", out JToken jTestNetBitcoinCoreHost))
@@ -356,6 +358,7 @@ namespace WalletWasabi.Gui
port = int.Parse(jTestNetBitcoinCorePort.ToString());
}
TestNetBitcoinP2pEndPoint = StringToEndPoint(jTestNetBitcoinCoreHost.ToString(), port);
+ saveIt = true;
}
if (res.TryGetValue("RegTestBitcoinCoreHost", out JToken jRegTestBitcoinCoreHost))
@@ -366,6 +369,12 @@ namespace WalletWasabi.Gui
port = int.Parse(jRegTestBitcoinCorePort.ToString());
}
RegTestBitcoinP2pEndPoint = StringToEndPoint(jRegTestBitcoinCoreHost.ToString(), port);
+ saveIt = true;
+
+ if (saveIt)
+ {
+ await ToFileAsync();
+ jsonString = await File.ReadAllTextAsync(FilePath, Encoding.UTF8);
}
var config = JsonConvert.DeserializeObject<Config>(jsonString);

Overwrite old config with the new one