aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2015-03-19 09:51:59 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2015-03-23 17:24:18 -0700
commitc6a63ceeb4956933588995bcf01dc3095aaeb1fc (patch)
treeb88a7fe5aebb9118f552d4be074a6e7eca22fa8d /src/net.cpp
parentf68ba3f67bd500a64fb8932c6b41924ddc31d76f (diff)
Always use a 50% chance to choose between tried and new entries
This change was suggested as Countermeasure 2 in Eclipse Attacks on Bitcoin’s Peer-to-Peer Network, Ethan Heilman, Alison Kendler, Aviv Zohar, Sharon Goldberg. ePrint Archive Report 2015/263. March 2015.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 0723ee218a..d8991ffa8d 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1221,8 +1221,7 @@ void ThreadOpenConnections()
int nTries = 0;
while (true)
{
- // use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections)
- CAddress addr = addrman.Select(10 + min(nOutbound,8)*10);
+ CAddress addr = addrman.Select();
// if we selected an invalid address, restart
if (!addr.IsValid() || setConnected.count(addr.GetGroup()) || IsLocal(addr))