Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 1,715 Lines • ▼ Show 20 Lines | for (const std::string &seed : vSeeds) { | ||||
std::vector<CAddress> vAdd; | std::vector<CAddress> vAdd; | ||||
ServiceFlags requiredServiceBits = | ServiceFlags requiredServiceBits = | ||||
GetDesirableServiceFlags(NODE_NONE); | GetDesirableServiceFlags(NODE_NONE); | ||||
std::string host = strprintf("x%x.%s", requiredServiceBits, seed); | std::string host = strprintf("x%x.%s", requiredServiceBits, seed); | ||||
CNetAddr resolveSource; | CNetAddr resolveSource; | ||||
if (!resolveSource.SetInternal(host)) { | if (!resolveSource.SetInternal(host)) { | ||||
continue; | continue; | ||||
} | } | ||||
if (LookupHost(host.c_str(), vIPs, 0, true)) { | |||||
// Limits number of IPs learned from a DNS seed | |||||
unsigned int nMaxIPs = 256; | |||||
if (LookupHost(host.c_str(), vIPs, nMaxIPs, true)) { | |||||
for (const CNetAddr &ip : vIPs) { | for (const CNetAddr &ip : vIPs) { | ||||
int nOneDay = 24 * 3600; | int nOneDay = 24 * 3600; | ||||
CAddress addr = CAddress( | CAddress addr = CAddress( | ||||
CService(ip, config->GetChainParams().GetDefaultPort()), | CService(ip, config->GetChainParams().GetDefaultPort()), | ||||
requiredServiceBits); | requiredServiceBits); | ||||
// Use a random age between 3 and 7 days old. | // Use a random age between 3 and 7 days old. | ||||
addr.nTime = GetTime() - 3 * nOneDay - GetRand(4 * nOneDay); | addr.nTime = GetTime() - 3 * nOneDay - GetRand(4 * nOneDay); | ||||
vAdd.push_back(addr); | vAdd.push_back(addr); | ||||
▲ Show 20 Lines • Show All 1,360 Lines • Show Last 20 Lines |