Skip to content

Commit

Permalink
[net] feeler connections can be made to outbound peers in same netgroup
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sdaftuar committed Feb 27, 2019
1 parent 4d83401 commit 4991e3c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1765,9 +1765,15 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
addr = addrman.Select(fFeeler);
}

// Require outbound connections to be to distinct network groups
if (!fFeeler && setConnected.count(addr.GetGroup())) {
break;
}

// if we selected an invalid address, restart
if (!addr.IsValid() || setConnected.count(addr.GetGroup()) || IsLocal(addr))
if (!addr.IsValid() || IsLocal(addr)) {
break;
}

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

0 comments on commit 4991e3c

Please sign in to comment.