aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2016-10-17 23:11:35 +0000
committerGregory Maxwell <greg@xiph.org>2016-10-19 08:07:02 +0000
commit46304791353d2bb61004a035869612620c30b4eb (patch)
tree6e3a8a5357a80d877f016ed2f66f35847af67853 /src/net.cpp
parent9583477288072e203541b747fcffe8d50cfefb8d (diff)
downloadbitcoin-46304791353d2bb61004a035869612620c30b4eb.tar.xz
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.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp
index de8f8184a2..99f5604ff2 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1462,12 +1462,19 @@ static std::string GetDNSHost(const CDNSSeedData& data, ServiceFlags* requiredSe
void CConnman::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;
}