diff options
| author | Pieter Wuille <[email protected]> | 2015-03-19 09:51:59 -0700 |
|---|---|---|
| committer | Ross Nicoll <[email protected]> | 2015-06-27 14:15:32 +0000 |
| commit | 9b95692530f38781a09f92c16193bbc94d1cdaf1 (patch) | |
| tree | 43a9707ad857a569dd7071375be428d1eeae0f1e /src/net.cpp | |
| parent | Do not bias outgoing connections towards fresh addresses (diff) | |
| download | discoin-9b95692530f38781a09f92c16193bbc94d1cdaf1.tar.xz discoin-9b95692530f38781a09f92c16193bbc94d1cdaf1.zip | |
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.
Rebased-From: c6a63ceeb4956933588995bcf01dc3095aaeb1fc
Github-Pull: #5941
Diffstat (limited to 'src/net.cpp')
| -rw-r--r-- | src/net.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp index b6ebf1cee..279ee4d76 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1360,8 +1360,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)) |