Skip to content

Commit

Permalink
Be more aggressive in connecting to peers with relevant services.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gmaxwell committed Oct 17, 2016
1 parent 763828d commit 9583477
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9583477

Please sign in to comment.