aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.cpp
AgeCommit message (Collapse)Author
2015-09-24Creates unittests for addrman, makes addrman testable.EthanHeilman
Adds several unittests for addrman to verify it works as expected. Makes small modifications to addrman to allow deterministic and targeted tests.
2015-08-26Improve addrman Select() performance when buckets are nearly emptyPieter Wuille
2015-06-15remove using namespace std from addrman.cppPhilip Kaufmann
2015-04-24Merge pull request #6028Wladimir J. van der Laan
1d5b47a nLastTry is only used for addrman entries (Pieter Wuille)
2015-04-19Cap nAttempts penalty at 8 and switch to pow instead of a division loop.Gregory Maxwell
On hosts that had spent some time with a failed internet connection their nAttempts penalty was going through the roof (e.g. thousands for all peers) and as a result the connect search was pegging the CPU and failing to get more than a 4 connections after days of running (because it was taking so long per try).
2015-04-19nLastTry is only used for addrman entriesPieter Wuille
No need to define it for every CAddress, as it's memory only anyway.
2015-03-23Always use a 50% chance to choose between tried and new entriesPieter Wuille
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.
2015-03-23Do not bias outgoing connections towards fresh addressesPieter Wuille
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.
2015-03-23Simplify hashing codePieter Wuille
2015-03-23Make addrman's bucket placement deterministic.Pieter Wuille
Give each address a single fixed location in the new and tried tables, which become simple fixed-size arrays instead of sets and vectors. This prevents attackers from having an advantages by inserting an address multiple times. This change was suggested as Countermeasure 1 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. It is also more efficient.
2015-03-23Switch addrman key from vector to uint256Pieter Wuille
2015-03-17Reduce fingerprinting through timestamps in 'addr' messages.Pieter Wuille
Suggested by Jonas Nick.
2015-01-05Replace GetLow64 with GetCheapHashWladimir J. van der Laan
2014-10-27Merge pull request #5119Pieter Wuille
fa73619 boost: split stream classes out of serialize.h (Cory Fields)
2014-10-24Update comments in addrman to be doxygen compatibleMichael Ford
Also correct the file license
2014-10-22boost: split stream classes out of serialize.hCory Fields
serialization now has no dependencies.
2014-09-19Apply clang-format on some infrequently-updated filesPieter Wuille
2014-09-05Improve readability of CAddrInfo::IsTerribleTeran McKinney
- Replaced 86400 with 24*60*60 - Remove references to specific timespans in comments Github-Pull: #4724
2014-08-18addrman: Do not propagate obviously poor addresses onto the networkJeff Garzik
2014-01-23Remove redundant .c_str()sWladimir J. van der Laan
After the tinyformat switch sprintf() family functions support passing actual std::string objects. Remove unnecessary c_str calls (236 of them) in logging and formatting.
2013-12-25Changed Get64(.) to GetLow64()Thomas Holenstein
The function Get64(.) has a bug in case the width is not divisible by 64. Since it is only ever used as Get64(0) this simply changes it to this special case. Additionally, an assert is added, and a cast to prevent a compiler error.
2013-11-10Cleanup code using forward declarations.Brandon Dahler
Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
2013-09-18Replace printf with LogPrintf / LogPrintGavin Andresen
2012-12-18Split off hash.h from util.hPieter Wuille
2012-09-18Trim trailing whitespace for src/*.{h,cpp}Jeff Garzik
2012-08-18fix a comment in addrman.cppPhilip Kaufmann
2012-05-18Update License in File HeadersFordy
I originally created a pull to replace the "COPYING" in crypter.cpp and crypter.h, but it turned out that COPYING was actually the correct file.
2012-05-09Clean up warningsPieter Wuille
* Use -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameters * Remove xCXXFLAGS usage in makefile.unix * Fix several recent and older sign-compare warnings
2012-05-05Fix addrman crashesPieter Wuille
A function returned the element to remove from a bucket, instead of its position in that bucket. This function was only called when a tried bucket overflowed, which only happens after many outgoing connections have been made. Closes: #1065, #1156
2012-05-05Add extra asserts to addrmanPieter Wuille
2012-04-17Further reduce header dependenciesPieter Wuille
This commit removes the dependency of serialize.h on PROTOCOL_VERSION, and makes this parameter required instead of implicit. This is much saner, as it makes the places where changing a version number can have an influence obvious.
2012-04-15Fix loop index var types, fixing many minor sign comparison warningsJeff Garzik
foo.size() typically returns an unsigned integral type; make loop variables match those types' signedness.
2012-04-15fix warnings: '&&' within '||' [-Wlogical-op-parentheses]Wladimir J. van der Laan
2012-02-24CAddrMan: stochastic address managerPieter Wuille
Design goals: * Only keep a limited number of addresses around, so that addr.dat does not grow without bound. * Keep the address tables in-memory, and occasionally write the table to addr.dat. * Make sure no (localized) attacker can fill the entire table with his nodes/addresses. See comments in addrman.h for more detailed information.