mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-08 06:35:25 +01:00
net: Have LookupNumeric return a CService directly
Also fix up a few small issues: - Lookup with "badip:port" now sets the port to 0 - Don't allow assert to have side-effects
This commit is contained in:
@@ -1098,8 +1098,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
std::string proxyArg = GetArg("-proxy", "");
|
||||
SetLimited(NET_TOR);
|
||||
if (proxyArg != "" && proxyArg != "0") {
|
||||
CService resolved;
|
||||
LookupNumeric(proxyArg.c_str(), resolved, 9050);
|
||||
CService resolved(LookupNumeric(proxyArg.c_str(), 9050));
|
||||
proxyType addrProxy = proxyType(resolved, proxyRandomize);
|
||||
if (!addrProxy.IsValid())
|
||||
return InitError(strprintf(_("Invalid -proxy address: '%s'"), proxyArg));
|
||||
@@ -1119,8 +1118,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
if (onionArg == "0") { // Handle -noonion/-onion=0
|
||||
SetLimited(NET_TOR); // set onions as unreachable
|
||||
} else {
|
||||
CService resolved;
|
||||
LookupNumeric(onionArg.c_str(), resolved, 9050);
|
||||
CService resolved(LookupNumeric(onionArg.c_str(), 9050));
|
||||
proxyType addrOnion = proxyType(resolved, proxyRandomize);
|
||||
if (!addrOnion.IsValid())
|
||||
return InitError(strprintf(_("Invalid -onion address: '%s'"), onionArg));
|
||||
|
||||
Reference in New Issue
Block a user