Skip to content

Commit 318176a

Browse files
committed
doc: Update high-level addrman description
1 parent 4b1fb50 commit 318176a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/addrman.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,23 @@ class CAddrInfo : public CAddress
104104
* * Make sure no (localized) attacker can fill the entire table with his nodes/addresses.
105105
*
106106
* To that end:
107-
* * Addresses are organized into buckets.
108-
* * Addresses that have not yet been tried go into 1024 "new" buckets.
109-
* * Based on the address range (/16 for IPv4) of the source of information, 64 buckets are selected at random.
107+
* * Addresses are organized into buckets that can each store up to 64 entries.
108+
* * Addresses to which our node has not successfully connected go into 1024 "new" buckets.
109+
* * Based on the address range (/16 for IPv4) of the source of information, or if an asmap is provided,
110+
* the AS it belongs to (for IPv4/IPv6), 64 buckets are selected at random.
110111
* * The actual bucket is chosen from one of these, based on the range in which the address itself is located.
112+
* * The position in the bucket is chosen based on the full address.
111113
* * One single address can occur in up to 8 different buckets to increase selection chances for addresses that
112114
* are seen frequently. The chance for increasing this multiplicity decreases exponentially.
113-
* * When adding a new address to a full bucket, a randomly chosen entry (with a bias favoring less recently seen
114-
* ones) is removed from it first.
115+
* * When adding a new address to an occupied position of a bucket, it will not replace the existing entry
116+
* unless that address is also stored in another bucket or it doesn't meet one of several quality criteria
117+
* (see IsTerrible for exact criteria).
115118
* * Addresses of nodes that are known to be accessible go into 256 "tried" buckets.
116119
* * Each address range selects at random 8 of these buckets.
117120
* * The actual bucket is chosen from one of these, based on the full address.
118-
* * When adding a new good address to a full bucket, a randomly chosen entry (with a bias favoring less recently
119-
* tried ones) is evicted from it, back to the "new" buckets.
121+
* * When adding a new good address to an occupied position of a bucket, a FEELER connection to the
122+
* old address is attempted. The old entry is only replaced and moved back to the "new" buckets if this
123+
* attempt was unsuccessful.
120124
* * Bucket selection is based on cryptographic hashing, using a randomly-generated 256-bit key, which should not
121125
* be observable by adversaries.
122126
* * Several indexes are kept for high performance. Defining DEBUG_ADDRMAN will introduce frequent (and expensive)

0 commit comments

Comments
 (0)