Fix related nullable warning
MODIFY
WalletWasabi.Backend/Config.cs
WalletWasabi.Backend/Config.cs
@@ -137,7 +137,7 @@ namespace WalletWasabi.Backend
{
int port = mainNetBitcoinCorePort ?? Constants.DefaultMainNetBitcoinP2pPort;
- if (EndPointParser.TryParse(mainNetBitcoinCoreHost, port, out EndPoint ep))
+ if (EndPointParser.TryParse(mainNetBitcoinCoreHost, port, out EndPoint? ep))
{
MainNetBitcoinP2pEndPoint = ep;
saveIt = true;
@@ -148,7 +148,7 @@ namespace WalletWasabi.Backend
{
int port = testNetBitcoinCorePort ?? Constants.DefaultTestNetBitcoinP2pPort;
- if (EndPointParser.TryParse(testNetBitcoinCoreHost, port, out EndPoint ep))
+ if (EndPointParser.TryParse(testNetBitcoinCoreHost, port, out EndPoint? ep))
{
TestNetBitcoinP2pEndPoint = ep;
saveIt = true;
@@ -159,7 +159,7 @@ namespace WalletWasabi.Backend
{
int port = regTestBitcoinCorePort ?? Constants.DefaultRegTestBitcoinP2pPort;
- if (EndPointParser.TryParse(regTestBitcoinCoreHost, port, out EndPoint ep))
+ if (EndPointParser.TryParse(regTestBitcoinCoreHost, port, out EndPoint? ep))
{
RegTestBitcoinP2pEndPoint = ep;
saveIt = true;

MODIFY
WalletWasabi.Gui/Config.cs
WalletWasabi.Gui/Config.cs
@@ -408,7 +408,7 @@ namespace WalletWasabi.Gui
{
int port = torSocks5Port ?? Constants.DefaultTorSocksPort;
- if (EndPointParser.TryParse(torHost, port, out EndPoint ep))
+ if (EndPointParser.TryParse(torHost, port, out EndPoint? ep))
{
TorSocks5EndPoint = ep;
saveIt = true;
@@ -419,7 +419,7 @@ namespace WalletWasabi.Gui
{
int port = mainNetBitcoinCorePort ?? Constants.DefaultMainNetBitcoinP2pPort;
- if (EndPointParser.TryParse(mainNetBitcoinCoreHost, port, out EndPoint ep))
+ if (EndPointParser.TryParse(mainNetBitcoinCoreHost, port, out EndPoint? ep))
{
MainNetBitcoinP2pEndPoint = ep;
saveIt = true;
@@ -430,7 +430,7 @@ namespace WalletWasabi.Gui
{
int port = testNetBitcoinCorePort ?? Constants.DefaultTestNetBitcoinP2pPort;
- if (EndPointParser.TryParse(testNetBitcoinCoreHost, port, out EndPoint ep))
+ if (EndPointParser.TryParse(testNetBitcoinCoreHost, port, out EndPoint? ep))
{
TestNetBitcoinP2pEndPoint = ep;
saveIt = true;
@@ -441,7 +441,7 @@ namespace WalletWasabi.Gui
{
int port = regTestBitcoinCorePort ?? Constants.DefaultRegTestBitcoinP2pPort;
- if (EndPointParser.TryParse(regTestBitcoinCoreHost, port, out EndPoint ep))
+ if (EndPointParser.TryParse(regTestBitcoinCoreHost, port, out EndPoint? ep))
{
RegTestBitcoinP2pEndPoint = ep;
saveIt = true;

MODIFY
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
@@ -357,11 +357,11 @@ namespace WalletWasabi.Gui.Tabs
config.LoadFile();
if (Network == config.Network)
{
- if (EndPointParser.TryParse(TorSocks5EndPoint, Constants.DefaultTorSocksPort, out EndPoint torEp))
+ if (EndPointParser.TryParse(TorSocks5EndPoint, Constants.DefaultTorSocksPort, out EndPoint? torEp))
{
config.TorSocks5EndPoint = torEp;
}
- if (EndPointParser.TryParse(BitcoinP2pEndPoint, network.DefaultPort, out EndPoint p2pEp))
+ if (EndPointParser.TryParse(BitcoinP2pEndPoint, network.DefaultPort, out EndPoint? p2pEp))
{
config.SetP2PEndpoint(p2pEp);
}

MODIFY
WalletWasabi.Tests/UnitTests/Userfacing/ParserTests.cs
WalletWasabi.Tests/UnitTests/Userfacing/ParserTests.cs
@@ -92,7 +92,7 @@ namespace WalletWasabi.Tests.UnitTests
{
foreach (var defaultPort in validPorts)
{
- var success = EndPointParser.TryParse(inputString, defaultPort, out EndPoint ep);
+ var success = EndPointParser.TryParse(inputString, defaultPort, out EndPoint? ep);
AssertEndPointParserOutputs(success, ep, host, defaultPort);
}
}
@@ -100,14 +100,14 @@ namespace WalletWasabi.Tests.UnitTests
// Default port is not used.
foreach (var inputString in inputsWithPorts)
{
- var success = EndPointParser.TryParse(inputString, 12345, out EndPoint ep);
+ var success = EndPointParser.TryParse(inputString, 12345, out EndPoint? ep);
AssertEndPointParserOutputs(success, ep, host, 5000);
}
// Default port is invalid, string port is not provided.
foreach (var inputString in inputsWithoutPorts)
{
- Assert.False(EndPointParser.TryParse(inputString, -1, out EndPoint ep));
+ Assert.False(EndPointParser.TryParse(inputString, -1, out EndPoint? ep));
}
// Defaultport doesn't correct invalid port input.
@@ -115,14 +115,14 @@ namespace WalletWasabi.Tests.UnitTests
{
foreach (var defaultPort in validPorts)
{
- Assert.False(EndPointParser.TryParse(inputString, defaultPort, out EndPoint ep));
+ Assert.False(EndPointParser.TryParse(inputString, defaultPort, out EndPoint? ep));
}
}
// Both default and string ports are invalid.
foreach (var inputString in inputsWithInvalidPorts)
{
- Assert.False(EndPointParser.TryParse(inputString, -1, out EndPoint ep));
+ Assert.False(EndPointParser.TryParse(inputString, -1, out EndPoint? ep));
}
}

MODIFY
WalletWasabi/BitcoinCore/CoreNode.cs
WalletWasabi/BitcoinCore/CoreNode.cs
@@ -95,7 +95,7 @@ namespace WalletWasabi.BitcoinCore
coreNodeParams.RpcEndPointStrategy.EndPoint.TryGetPort(out rpcPort);
}
- EndPointParser.TryParse($"{rpcHost}:{rpcPort}", coreNode.Network.RPCPort, out EndPoint rpce);
+ EndPointParser.TryParse($"{rpcHost}:{rpcPort}", coreNode.Network.RPCPort, out EndPoint? rpce);
coreNode.RpcEndPoint = rpce;
var rpcClient = new RPCClient(

MODIFY
WalletWasabi/JsonConverters/EndPointJsonConverter.cs
WalletWasabi/JsonConverters/EndPointJsonConverter.cs
@@ -33,7 +33,7 @@ namespace WalletWasabi.JsonConverters
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
string endPointString = reader.Value as string;
- if (EndPointParser.TryParse(endPointString, DefaultPort, out EndPoint endPoint))
+ if (EndPointParser.TryParse(endPointString, DefaultPort, out EndPoint? endPoint))
{
return endPoint;
}

Fix related nullable warning