What does the bitcoin protocol do to handle collisions when adding addresses to the new table?
Asked
Active
Viewed 69 times
0
-
1What addresses and what new table? – Vojtěch Strnad Oct 08 '22 at 20:26
-
The addresses that are in the addr message are placed into the new table of bitcoin core. – Vinay Shetty Oct 08 '22 at 20:29
-
Surely addr entries can't collide because there is no expectation that each peer has no peers in common. If two peers report a common addr entry wouldn't you just keep the common value in your table? – RedGrittyBrick Oct 08 '22 at 20:53
1 Answers
1
In case of a collision of addrs in the new table, the existing address will normally stay (and nothing changes) - unless
- the existing entry is already present somewhere else in the new table (an address can be in up to 8 different buckets/positions at the same time), or
- if the existing entry is of bad quality ("terrible")
In these two cases the existing entry will be replaced by the new one. There are several criteria by which a node can be terrible, roughly:
- if its timestamp is too far in the future or too far in the past from the current time.
- if we unsuccessfully tried to connect to it too often in the past
See Addrman::IsTerrible() for details / exact limits. It may also be worth to mention that the behavior in case of collisions in the tried table is very different from this ("test before evict").
Lightlike
- 581
- 1
- 12