aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2016-10-17 23:08:52 +0000
committerGregory Maxwell <greg@xiph.org>2016-10-17 23:08:52 +0000
commit9583477288072e203541b747fcffe8d50cfefb8d (patch)
tree6ef99e228311d612669e8ad7dffc5e84eb8d60b2 /src/net.cpp
parent763828df499f67c1c9d669d3223bd0636ed2b185 (diff)
downloadbitcoin-9583477288072e203541b747fcffe8d50cfefb8d.tar.xz
Be more aggressive in connecting to peers with relevant services.
Only allow skipping relevant services until there are four outbound connections up. This avoids quickly filling up with peers lacking the relevant services when addrman has few or none of them.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 5f9942c9dc..de8f8184a2 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1675,8 +1675,8 @@ void CConnman::ThreadOpenConnections()
if (nANow - addr.nLastTry < 600 && nTries < 30)
continue;
- // only consider nodes missing relevant services after 40 failed attempts
- if ((addr.nServices & nRelevantServices) != nRelevantServices && nTries < 40)
+ // only consider nodes missing relevant services after 40 failed attempts and only if less than half the outbound are up.
+ if ((addr.nServices & nRelevantServices) != nRelevantServices && (nTries < 40 || nOutbound >= (nMaxOutbound >> 1)))
continue;
// do not allow non-default ports, unless after 50 invalid addresses selected already