Skip to content

Commit

Permalink
Output channel_id in listfunds
Browse files Browse the repository at this point in the history
Changelog-Added: JSON-RPC: `listfunds` now has a `channel_id` field.
  • Loading branch information
kristapsk authored and vincenzopalazzo committed Mar 21, 2023
1 parent fca6211 commit 906279a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@
},
"ListfundsChannels": {
"ListFunds.channels[].amount_msat": 3,
"ListFunds.channels[].channel_id": 9,
"ListFunds.channels[].connected": 6,
"ListFunds.channels[].funding_output": 5,
"ListFunds.channels[].funding_txid": 4,
Expand Down
1 change: 1 addition & 0 deletions cln-grpc/proto/node.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ def listfunds_channels2py(m):
"funding_output": m.funding_output, # PrimitiveField in generate_composite
"connected": m.connected, # PrimitiveField in generate_composite
"state": str(m.state), # EnumField in generate_composite
"channel_id": hexlify(m.channel_id), # PrimitiveField in generate_composite
"short_channel_id": m.short_channel_id, # PrimitiveField in generate_composite
})

Expand Down
3 changes: 2 additions & 1 deletion doc/lightning-listfunds.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ On success, an object is returned, containing:
- **funding\_output** (u32): the 0-based index of the output in the funding transaction
- **connected** (boolean): whether the channel peer is connected
- **state** (string): the channel state, in particular "CHANNELD\_NORMAL" means the channel can be used normally (one of "OPENINGD", "CHANNELD\_AWAITING\_LOCKIN", "CHANNELD\_NORMAL", "CHANNELD\_SHUTTING\_DOWN", "CLOSINGD\_SIGEXCHANGE", "CLOSINGD\_COMPLETE", "AWAITING\_UNILATERAL", "FUNDING\_SPEND\_SEEN", "ONCHAIN", "DUALOPEND\_OPEN\_INIT", "DUALOPEND\_AWAITING\_LOCKIN")
- **channel\_id** (hash): The full channel\_id (funding txid Xored with output number) *(added v23.02)*

If **state** is "CHANNELD\_NORMAL":

Expand All @@ -73,4 +74,4 @@ RESOURCES

Main web site: <https://github.com/ElementsProject/lightning>

[comment]: # ( SHA256STAMP:3282d4025e161d6926878a5fc8d78384784885749630f007cc5dfcd8d2794b10)
[comment]: # ( SHA256STAMP:ae6228c9cc323e0b6486eb4d2695105b087e98770763c6f9e5af3b888fa9520f)
10 changes: 9 additions & 1 deletion doc/schemas/listfunds.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
"funding_txid",
"funding_output",
"connected",
"state"
"state",
"channel_id"
],
"properties": {
"peer_id": {
Expand Down Expand Up @@ -186,6 +187,11 @@
"DUALOPEND_AWAITING_LOCKIN"
],
"description": "the channel state, in particular \"CHANNELD_NORMAL\" means the channel can be used normally"
},
"channel_id": {
"type": "hash",
"description": "The full channel_id (funding txid Xored with output number)",
"added": "v23.05"
}
},
"allOf": [
Expand Down Expand Up @@ -215,6 +221,7 @@
"funding_output": {},
"connected": {},
"state": {},
"channel_id": {},
"short_channel_id": {
"type": "short_channel_id",
"description": "short channel id of channel"
Expand Down Expand Up @@ -251,6 +258,7 @@
"funding_output": {},
"connected": {},
"state": {},
"channel_id": {},
"short_channel_id": {
"type": "short_channel_id",
"description": "short channel id of channel (only if funding reached lockin depth before closing)"
Expand Down
1 change: 1 addition & 0 deletions wallet/walletrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ static struct command_result *json_listfunds(struct command *cmd,
channel_is_connected(c));
json_add_string(response, "state",
channel_state_name(c));
json_add_channel_id(response, "channel_id", &c->cid);
if (c->scid)
json_add_short_channel_id(response,
"short_channel_id",
Expand Down

0 comments on commit 906279a

Please sign in to comment.