0

What does the bitcoin protocol do to handle collisions when adding addresses to the new table?

Lightlike
  • 581
  • 1
  • 12
Vinay Shetty
  • 115
  • 5

1 Answers1

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