From 0f4ad8c316ac6d144ced6fd0fbc3e8a478707fd9 Mon Sep 17 00:00:00 2001 From: Javier Vargas Date: Tue, 28 Jul 2020 17:09:54 +0200 Subject: [PATCH] Update 13_6_Closing_a_Channel.md --- 13_6_Closing_a_Channel.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/13_6_Closing_a_Channel.md b/13_6_Closing_a_Channel.md index 31535a6..25947db 100644 --- a/13_6_Closing_a_Channel.md +++ b/13_6_Closing_a_Channel.md @@ -60,4 +60,22 @@ In this case both channel participants agree to close the channel and settle the In this case when only one participant is online or if the participants disagree on the last state of the channel, so one peer can perform an unilateral close of the channel without the cooperation of the other node. It's performed by broadcasting a commitment transaction that commits to a previous channel state which both parts have agreed upon. This commitment transaction contains the channel state divided in two parts: the balance of each participant and all the pending payments (HTLCs). +### Node Information + +Now we'll show you how to get information about your channel using `lightning-cli listchannels` command. The listchannels RPC command returns data on channels that are known to the node. Because channels may be bidirectional, up to 2 objects will be returned for each channel (one for each direction). To query information about own channels we'll use jq tool showed in previous chapters. + +First we'll get our own node id public_key in NODEID variable. + +``` +c$ NODEID=$(lightning-cli --network=testnet getinfo | jq .id) +c$ echo $NODEID +"03fce2a20393a65b9d6cab5425f4cd33ddc621ade458efd69d652917e2b5eaf59c" +c$ +``` +Later we'll use select to show only data containing public_key id as source or destination. + +``` +$ lightning-cli listchannels | jq '.channels[] | select(.source == '$NODEID' or .destination == '$NODEID')' +``` +