p2p, refactor: return std::optional<CNetAddr> in LookupHost

This commit is contained in:
brunoerg
2022-10-11 13:37:45 -03:00
parent 34bcdfc6a6
commit 5c832c3820
12 changed files with 61 additions and 83 deletions

View File

@@ -406,9 +406,8 @@ void OptionsDialog::updateProxyValidationState()
void OptionsDialog::updateDefaultProxyNets()
{
CNetAddr ui_proxy_netaddr;
LookupHost(ui->proxyIp->text().toStdString(), ui_proxy_netaddr, /*fAllowLookup=*/false);
const CService ui_proxy{ui_proxy_netaddr, ui->proxyPort->text().toUShort()};
const std::optional<CNetAddr> ui_proxy_netaddr{LookupHost(ui->proxyIp->text().toStdString(), /*fAllowLookup=*/false)};
const CService ui_proxy{ui_proxy_netaddr.value_or(CNetAddr{}), ui->proxyPort->text().toUShort()};
Proxy proxy;
bool has_proxy;