mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +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:
@@ -93,9 +93,7 @@ BOOST_AUTO_TEST_CASE(netbase_splithost)
|
||||
|
||||
bool static TestParse(string src, string canon)
|
||||
{
|
||||
CService addr;
|
||||
if (!LookupNumeric(src.c_str(), addr, 65535))
|
||||
return canon == "";
|
||||
CService addr(LookupNumeric(src.c_str(), 65535));
|
||||
return canon == addr.ToString();
|
||||
}
|
||||
|
||||
@@ -107,7 +105,7 @@ BOOST_AUTO_TEST_CASE(netbase_lookupnumeric)
|
||||
BOOST_CHECK(TestParse("::", "[::]:65535"));
|
||||
BOOST_CHECK(TestParse("[::]:8333", "[::]:8333"));
|
||||
BOOST_CHECK(TestParse("[127.0.0.1]", "127.0.0.1:65535"));
|
||||
BOOST_CHECK(TestParse(":::", ""));
|
||||
BOOST_CHECK(TestParse(":::", "[::]:0"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(onioncat_test)
|
||||
|
||||
Reference in New Issue
Block a user