Skip to content

Commit 0a64777

Browse files
committed
Merge #8208: Do not set extra flags for unfiltered DNS seed results
bc0a895 Do not set extra flags for unfiltered DNS seed results (Pieter Wuille)
2 parents f7a403b + bc0a895 commit 0a64777

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/chainparams.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616

1717
#include "chainparamsseeds.h"
1818

19-
std::string CDNSSeedData::getHost(uint64_t requiredServiceBits) const {
20-
//use default host for non-filter-capable seeds or if we use the default service bits (NODE_NETWORK)
21-
if (!supportsServiceBitsFiltering || requiredServiceBits == NODE_NETWORK)
22-
return host;
23-
24-
return strprintf("x%x.%s", requiredServiceBits, host);
25-
}
26-
2719
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
2820
{
2921
CMutableTransaction txNew;

src/chainparams.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313

1414
#include <vector>
1515

16-
class CDNSSeedData {
17-
public:
16+
struct CDNSSeedData {
1817
std::string name, host;
1918
bool supportsServiceBitsFiltering;
20-
std::string getHost(uint64_t requiredServiceBits) const;
2119
CDNSSeedData(const std::string &strName, const std::string &strHost, bool supportsServiceBitsFilteringIn = false) : name(strName), host(strHost), supportsServiceBitsFiltering(supportsServiceBitsFilteringIn) {}
2220
};
2321

src/net.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,18 @@ void MapPort(bool)
14151415

14161416

14171417

1418+
static std::string GetDNSHost(const CDNSSeedData& data, ServiceFlags* requiredServiceBits)
1419+
{
1420+
//use default host for non-filter-capable seeds or if we use the default service bits (NODE_NETWORK)
1421+
if (!data.supportsServiceBitsFiltering || *requiredServiceBits == NODE_NETWORK) {
1422+
*requiredServiceBits = NODE_NETWORK;
1423+
return data.host;
1424+
}
1425+
1426+
return strprintf("x%x.%s", *requiredServiceBits, data.host);
1427+
}
1428+
1429+
14181430
void ThreadDNSAddressSeed()
14191431
{
14201432
// goal: only query DNS seeds if address need is acute
@@ -1441,7 +1453,7 @@ void ThreadDNSAddressSeed()
14411453
std::vector<CNetAddr> vIPs;
14421454
std::vector<CAddress> vAdd;
14431455
ServiceFlags requiredServiceBits = nRelevantServices;
1444-
if (LookupHost(seed.getHost(requiredServiceBits).c_str(), vIPs, 0, true))
1456+
if (LookupHost(GetDNSHost(seed, &requiredServiceBits).c_str(), vIPs, 0, true))
14451457
{
14461458
BOOST_FOREACH(const CNetAddr& ip, vIPs)
14471459
{

0 commit comments

Comments
 (0)