kad: Query::next_action()
message is ignored by the kademlia handler #230
Description
Query::next_action()
method returns a QueryAction
that contains a raw kademlia message.
For the FindNode
query type it is the FIND_NODE
message, for GetRecords
query type it is the GET_VALUE
message.
The message is ignored by the kademlia handler on_query_action
method:
litep2p/src/protocol/libp2p/kademlia/mod.rs
Lines 787 to 791 in e3a22d5
The following lines are ignoring the provided message, and sending the FindNode
request regardless of the message provided:
litep2p/src/protocol/libp2p/kademlia/mod.rs
Lines 700 to 707 in e3a22d5
The intention behind this behavior was to advance the discoverability of the network. For example, GetRecords
query must first discover the network, then publish a GET_VALUE
request.
Consider untangling the query message with the kademlia handler and to allow queries to decide which message should be sent.
We can further look into optimizing the number of messages sent from the query engine to the kademlia handler (since some of them may be redundant as in this case)