aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2019-02-26 15:04:48 -0500
committerWladimir J. van der Laan <laanwj@gmail.com>2019-03-09 07:13:21 +0100
commit487f0c3dc92285bb4388c86c03c2caafe26171c4 (patch)
tree347157441d6a47fd55763a1a0ffadc470e0f0fa8
parent561b00a02ba88b1c830dbed28d917b8d53199cbf (diff)
downloadbitcoin-487f0c3dc92285bb4388c86c03c2caafe26171c4.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. Github-Pull: #15486 Rebased-From: 4991e3c813c9848d3b3957ea3ad433f02fca9e81 Tree-SHA512: 2752c9909d55ff63b9143168033d0d3952effba7f911181919eb62291edf822ec54fffbb20e35b5c5f8cb1092d75c496665da00139dbebe5ce402cbea3ad87c5
-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