Remove unnecessary backing field.
MODIFY
WalletWasabi.Backend/Config.cs
WalletWasabi.Backend/Config.cs
@@ -39,33 +39,26 @@ namespace WalletWasabi.Backend
[JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultRegTestBitcoinP2pPort)]
public EndPoint RegTestBitcoinP2pEndPoint { get; internal set; }
- private EndPoint _bitcoinP2pEndPoint;
-
public EndPoint GetBitcoinP2pEndPoint()
- {
- if (_bitcoinP2pEndPoint is null)
{
if (Network == Network.Main)
{
- _bitcoinP2pEndPoint = MainNetBitcoinP2pEndPoint;
+ return MainNetBitcoinP2pEndPoint;
}
else if (Network == Network.TestNet)
{
- _bitcoinP2pEndPoint = TestNetBitcoinP2pEndPoint;
+ return TestNetBitcoinP2pEndPoint;
}
else if (Network == Network.RegTest)
{
- _bitcoinP2pEndPoint = RegTestBitcoinP2pEndPoint;
+ return RegTestBitcoinP2pEndPoint;
}
else
{
- throw new NotSupportedException("Network not supported.");
+ throw new NotSupportedException($"{nameof(Network)} not supported: {Network}.");
}
}
- return _bitcoinP2pEndPoint;
- }
-
public Config()
{
}

MODIFY
WalletWasabi.Gui/Config.cs
WalletWasabi.Gui/Config.cs
@@ -193,7 +193,6 @@ namespace WalletWasabi.Gui
private int? _privacyLevelSome;
private int? _privacyLevelFine;
private int? _privacyLevelStrong;
- private EndPoint _bitcoinP2pEndPoint;
public IPEndPoint GetTorSocks5EndPoint()
{
@@ -206,28 +205,23 @@ namespace WalletWasabi.Gui
}
public EndPoint GetBitcoinP2pEndPoint()
- {
- if (_bitcoinP2pEndPoint is null)
{
if (Network == Network.Main)
{
- _bitcoinP2pEndPoint = MainNetBitcoinP2pEndPoint;
+ return MainNetBitcoinP2pEndPoint;
}
else if (Network == Network.TestNet)
{
- _bitcoinP2pEndPoint = TestNetBitcoinP2pEndPoint;
+ return TestNetBitcoinP2pEndPoint;
}
else if (Network == Network.RegTest)
{
- _bitcoinP2pEndPoint = RegTestBitcoinP2pEndPoint;
+ return RegTestBitcoinP2pEndPoint;
}
else
{
- throw new NotSupportedException("Network not supported.");
- }
+ throw new NotSupportedException($"{nameof(Network)} not supported: {Network}.");
}
-
- return _bitcoinP2pEndPoint;
}
public Config()

Remove unnecessary backing field.