3

I believe there must be a heuristic that determines which IPs are returned to clients by the seeder.

The seeder may have a list of hundreds of available nodes, but it only returns a reduced subset when queried.

Where in the code is the determination made of which IPs to return in response to a DNS query (out of all nodes the seeder is tracking and marks available)?

Note: The author of bitcoin-seeder (sipa) has stated that as many IP's as fit in a UDP data packet are returned (So there is no max_addr_return variable or such similar setting)

RedGrittyBrick
  • 24,039
  • 3
  • 23
  • 47
dbkeys
  • 637
  • 3
  • 14

1 Answers1

3

The answer is simple: it returns as many as fit in a DNS UDP packet (512 bytes).

Pieter Wuille
  • 98,249
  • 9
  • 183
  • 287
  • Thank you Peter, that is informative; maar .. can you shed some light on how the addresses are chosen when the packet is filled ? For example, btc.intersim.com shows 3681/948038 available; when queried for IPv4 it returns 24 addresses and when queried for IPv6, only 14. (This makes sense, as less IPv6's will fit in a 512 byte UDP packet). But how does `dnsseed` pick these out from the over 3,600 that it judges "available" ? (in this example) – dbkeys May 08 '23 at 18:46
  • Note: I have edited the question; I originally asked how many IP's are returned; but of greater interest IMO is _how_ these are chosen from the set of nodes that `dnseed` has marked as available. Is it random or is there some priority function ? – dbkeys May 08 '23 at 19:00