Skip to content

Commit 4991e3c

Browse files
committed
[net] feeler connections can be made to outbound peers in same netgroup
Fixes a bug where feelers could be stuck trying to resolve a collision in the tried table that is to an address in the same netgroup as an existing outbound peer. Thanks to Muoi Tran for the original bug report and detailed debug logs to track this down.
1 parent 4d83401 commit 4991e3c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/net.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,9 +1765,15 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
17651765
addr = addrman.Select(fFeeler);
17661766
}
17671767

1768+
// Require outbound connections to be to distinct network groups
1769+
if (!fFeeler && setConnected.count(addr.GetGroup())) {
1770+
break;
1771+
}
1772+
17681773
// if we selected an invalid address, restart
1769-
if (!addr.IsValid() || setConnected.count(addr.GetGroup()) || IsLocal(addr))
1774+
if (!addr.IsValid() || IsLocal(addr)) {
17701775
break;
1776+
}
17711777

17721778
// If we didn't find an appropriate destination after trying 100 addresses fetched from addrman,
17731779
// stop this loop, and let the outer loop run again (which sleeps, adds seed nodes, recalculates

0 commit comments

Comments
 (0)