mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-07-25 02:45:52 +00:00
Update 13_6_Closing_a_Channel.md
This commit is contained in:
parent
b6182c3803
commit
0f4ad8c316
@ -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')'
|
||||
```
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user