diff options
author | Gregory Maxwell <greg@xiph.org> | 2016-10-17 23:08:52 +0000 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-10-19 11:23:53 +0200 |
commit | 33cd5539b2f96a1cc4f7a660e317d3484eb6ffc4 (patch) | |
tree | a82d6b74cc294fd41b875b37787f9b418927d63e /src | |
parent | 2c0913d0b3e14dd641bd3e0f49992ab86bd5d5f1 (diff) |
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.
Github-Pull: #8949
Rebased-From: 9583477288072e203541b747fcffe8d50cfefb8d
Diffstat (limited to 'src')
-rw-r--r-- | src/net.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp index 42fde43530..b28ce0b8a3 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1707,8 +1707,8 @@ void 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 |