diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2015-04-25 16:25:44 -0400 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2015-04-30 08:16:20 -0700 |
commit | d81cff32e50fe5f686f985d0af2e74219f328ed0 (patch) | |
tree | 4ed441d73f9e62a1d17c69c721e4cae1bd88e1de /src/crypto/hmac_sha256.h | |
parent | 69a5f8be0abda1e462f8ef44acadd2cbfaa850fb (diff) |
Replace mruset setAddrKnown with CRollingBloomFilter addrKnown
Use a probabilistic bloom filter to keep track of which addresses
we think we have given our peers, instead of a list.
This uses much less memory, at the cost of sometimes failing to
relay an address to a peer-- worst case if the bloom filter happens
to be as full as it gets, 1-in-1,000.
Measured memory usage of a full mruset setAddrKnown: 650Kbytes
Constant memory usage of CRollingBloomFilter addrKnown: 37Kbytes.
This will also help heap fragmentation, because the 37K of storage
is allocated when a CNode is created (when a connection to a peer
is established) and then there is no per-item-remembered memory
allocation.
I plan on testing by restarting a full node with an empty peers.dat,
running a while with -debug=addrman and -debug=net, and making sure
that the 'addr' message traffic out is reasonable.
(suggestions for better tests welcome)
Diffstat (limited to 'src/crypto/hmac_sha256.h')
0 files changed, 0 insertions, 0 deletions