Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I reviced Compact node info in find_node response message is not 26 bytes?

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?

like image 346
wang ming Avatar asked Nov 19 '25 01:11

wang ming


1 Answers

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.

like image 58
Encombe Avatar answered Nov 22 '25 02:11

Encombe