Skip to content

Commit 9583477

Browse files
committed
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.
1 parent 763828d commit 9583477

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/net.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,8 +1675,8 @@ void CConnman::ThreadOpenConnections()
16751675
if (nANow - addr.nLastTry < 600 && nTries < 30)
16761676
continue;
16771677

1678-
// only consider nodes missing relevant services after 40 failed attempts
1679-
if ((addr.nServices & nRelevantServices) != nRelevantServices && nTries < 40)
1678+
// only consider nodes missing relevant services after 40 failed attempts and only if less than half the outbound are up.
1679+
if ((addr.nServices & nRelevantServices) != nRelevantServices && (nTries < 40 || nOutbound >= (nMaxOutbound >> 1)))
16801680
continue;
16811681

16821682
// do not allow non-default ports, unless after 50 invalid addresses selected already

0 commit comments

Comments
 (0)