What is the difference between listpeers vs listnodes commands? In c-lightning implementation, what is the difference between the listpeers and listnodes commands of lightning-cli?
listpeers

listpeers returns data on nodes that you have connected with OR the nodes with which you have an open channel. If you have an open channel with a node, but the connection with that node has been lost, then the node will still appear in the output, with "connected": false. If you are connected with a node but do not have open channels, then it will return the output with "channels": [].

If you want to get information about a particular peer and not all of them, then you can add the node id of the peer like: lightning-cli listpeers &lt;node_id&gt;. You can also query log entries related to the peer by passing the command: lightning-cli listpeers &lt;node_id&gt; &lt;level&gt; where level can be io, debug, info, and unusual. Log levels can only be queried if a node id is supplied.

listnodes

listnodes will return the information of all the nodes in your local network view. This information is collected via the gossip network. If you pass the listnodes command without a node id, then the RPC will return information of ALL the nodes in your view. If you are interested in the information of a particular node id, then you can do so by passing the command: lightning-cli listnodes &lt;nodeid&gt;.