2

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

3

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 <node_id>. You can also query log entries related to the peer by passing the command: lightning-cli listpeers <node_id> <level> 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 <nodeid>.

2

listpeers show current peers, which means your node has been peered to other nodes that are shown in the command. It also means you are ready to fund channels with these nodes.

listnodes show nodes in your local network information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.