Skip to content

Commit 1d21ba2

Browse files
committed
Scale up addrman
This change was suggested as Countermeasure 6 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.
1 parent c6a63ce commit 1d21ba2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/addrman.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ class CAddrInfo : public CAddress
109109
*
110110
* To that end:
111111
* * Addresses are organized into buckets.
112-
* * Address that have not yet been tried go into 256 "new" buckets.
113-
* * Based on the address range (/16 for IPv4) of source of the information, 32 buckets are selected at random
112+
* * Address that have not yet been tried go into 1024 "new" buckets.
113+
* * Based on the address range (/16 for IPv4) of source of the information, 64 buckets are selected at random
114114
* * The actual bucket is chosen from one of these, based on the range the address itself is located.
115-
* * One single address can occur in up to 4 different buckets, to increase selection chances for addresses that
115+
* * One single address can occur in up to 8 different buckets, to increase selection chances for addresses that
116116
* are seen frequently. The chance for increasing this multiplicity decreases exponentially.
117117
* * When adding a new address to a full bucket, a randomly chosen entry (with a bias favoring less recently seen
118118
* ones) is removed from it first.
119-
* * Addresses of nodes that are known to be accessible go into 64 "tried" buckets.
120-
* * Each address range selects at random 4 of these buckets.
119+
* * Addresses of nodes that are known to be accessible go into 256 "tried" buckets.
120+
* * Each address range selects at random 8 of these buckets.
121121
* * The actual bucket is chosen from one of these, based on the full address.
122122
* * When adding a new good address to a full bucket, a randomly chosen entry (with a bias favoring less recently
123123
* tried ones) is evicted from it, back to the "new" buckets.
@@ -128,22 +128,22 @@ class CAddrInfo : public CAddress
128128
*/
129129

130130
//! total number of buckets for tried addresses
131-
#define ADDRMAN_TRIED_BUCKET_COUNT 64
131+
#define ADDRMAN_TRIED_BUCKET_COUNT 256
132132

133133
//! total number of buckets for new addresses
134-
#define ADDRMAN_NEW_BUCKET_COUNT 256
134+
#define ADDRMAN_NEW_BUCKET_COUNT 1024
135135

136136
//! maximum allowed number of entries in buckets for new and tried addresses
137137
#define ADDRMAN_BUCKET_SIZE 64
138138

139139
//! over how many buckets entries with tried addresses from a single group (/16 for IPv4) are spread
140-
#define ADDRMAN_TRIED_BUCKETS_PER_GROUP 4
140+
#define ADDRMAN_TRIED_BUCKETS_PER_GROUP 8
141141

142142
//! over how many buckets entries with new addresses originating from a single group are spread
143-
#define ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP 32
143+
#define ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP 64
144144

145145
//! in how many buckets for entries with new addresses a single address may occur
146-
#define ADDRMAN_NEW_BUCKETS_PER_ADDRESS 4
146+
#define ADDRMAN_NEW_BUCKETS_PER_ADDRESS 8
147147

148148
//! how old addresses can maximally be
149149
#define ADDRMAN_HORIZON_DAYS 30

0 commit comments

Comments
 (0)