aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2019-02-26 15:04:48 -0500
committerSuhas Daftuar <sdaftuar@gmail.com>2019-02-27 09:30:13 -0500
commit4991e3c813c9848d3b3957ea3ad433f02fca9e81 (patch)
treed68f196b83c23b139f21d228390b64373401eeef /src/net.cpp
parent4d834018e368c3481a5421891395f64aa9002185 (diff)
downloadbitcoin-4991e3c813c9848d3b3957ea3ad433f02fca9e81.tar.xz
[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.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 87f1ef0577..3f87dc6357 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -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