aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2016-10-17 23:11:35 +0000
committerWladimir J. van der Laan <laanwj@gmail.com>2016-10-19 11:24:12 +0200
commit91ae0b06b9d56a06bd0aae498571a7785ee385ee (patch)
treea0ff3b277e5fa97da7627028566ffac435d027ea
parent33cd5539b2f96a1cc4f7a660e317d3484eb6ffc4 (diff)
Make dnsseed's definition of acute need include relevant services.
We normally prefer to connect to peers offering the relevant services. If we're not connected to enough peers with relevant services, we probably don't know about them and could use dnsseed's help. Github-Pull: #8949 Rebased-From: 46304791353d2bb61004a035869612620c30b4eb
-rw-r--r--src/net.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp
index b28ce0b8a3..9bfdb9bc2e 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1497,12 +1497,19 @@ static std::string GetDNSHost(const CDNSSeedData& data, ServiceFlags* requiredSe
void ThreadDNSAddressSeed()
{
// goal: only query DNS seeds if address need is acute
+ // Avoiding DNS seeds when we don't need them improves user privacy by
+ // creating fewer identifying DNS requests, reduces trust by giving seeds
+ // less influence on the network topology, and reduces traffic to the seeds.
if ((addrman.size() > 0) &&
(!GetBoolArg("-forcednsseed", DEFAULT_FORCEDNSSEED))) {
MilliSleep(11 * 1000);
LOCK(cs_vNodes);
- if (vNodes.size() >= 2) {
+ int nRelevant = 0;
+ for (auto pnode : vNodes) {
+ nRelevant += pnode->fSuccessfullyConnected && ((pnode->nServices & nRelevantServices) == nRelevantServices);
+ }
+ if (nRelevant >= 2) {
LogPrintf("P2P peers available. Skipped DNS seeding.\n");
return;
}