diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2015-03-19 09:51:59 -0700 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-04-01 16:39:36 +0200 |
commit | 0c6f334c32f2ef5b7224ec7f5ac694153a7f4241 (patch) | |
tree | bf655d2f73990a02b83226e6672db44f0a8bbd63 /src/addrman.h | |
parent | 214154e6fc65bdc06fbfe1bc04b9b57347fdb3f7 (diff) | |
download | bitcoin-0c6f334c32f2ef5b7224ec7f5ac694153a7f4241.tar.xz |
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/addrman.h')
-rw-r--r-- | src/addrman.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/addrman.h b/src/addrman.h index 3966bf5b73..5eb19758d5 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -231,7 +231,7 @@ protected: //! Select an address to connect to. //! nUnkBias determines how much to favor new addresses over tried ones (min=0, max=100) - CAddress Select_(int nUnkBias); + CAddress Select_(); #ifdef DEBUG_ADDRMAN //! Perform consistency check. Returns an error code or zero. @@ -533,13 +533,13 @@ public: * Choose an address to connect to. * nUnkBias determines how much "new" entries are favored over "tried" ones (0-100). */ - CAddress Select(int nUnkBias = 50) + CAddress Select() { CAddress addrRet; { LOCK(cs); Check(); - addrRet = Select_(nUnkBias); + addrRet = Select_(); Check(); } return addrRet; |