3

In BEP5 said

Contact information for nodes is encoded as a 26-byte string. Also known as "Compact node info" the 20-byte Node ID in network byte order has the compact IP-address/port info concatenated to the end.

and

When a node receives a find_node query, it should respond with a key "nodes" and value of a string containing the compact node info for the target node or the K (8) closest good nodes in its own routing table.

In My find_node response Of java, the Compact node info bytes is not 26 bytes, why?

Encombe
  • 2,003
  • 1
  • 17
  • 26
wang ming
  • 199
  • 2
  • 9

1 Answers1

1

The value for the key nodes can contain more than one node as indicated by the quote from BEP5:

... or the K (8) closest good nodes in its own routing table.

8 * 26 = 208 bytes value length with 8 Compact node infos concatenated together.
Many clients even sends the double amount of nodes: 16 * 26 = 416 bytes length.

In practise should a client accept any length that is evenly divisible by 26.

Encombe
  • 2,003
  • 1
  • 17
  • 26