Skip to content

Commit

Permalink
lightningd: deprecate listpeers.channels
Browse files Browse the repository at this point in the history
Changelog-Deprecated: JSON-RPC: `listpeers` `channels` array: use `listpeerchannels`

Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo authored and rustyrussell committed Jan 13, 2023
1 parent 9ffaab7 commit 6c0b9b0
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 37 deletions.
2 changes: 1 addition & 1 deletion cln-grpc/src/convert.rs

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

5 changes: 3 additions & 2 deletions cln-rpc/src/model.rs

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

46 changes: 23 additions & 23 deletions doc/lightning-listpeers.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,28 @@ On success, an object containing **peers** is returned. It is an array of objec

- **id** (pubkey): the public key of the peer
- **connected** (boolean): True if the peer is currently connected
- **channels** (array of objects):
- **log** (array of objects, optional): if *level* is specified, logs for this peer:
- **type** (string) (one of "SKIPPED", "BROKEN", "UNUSUAL", "INFO", "DEBUG", "IO\_IN", "IO\_OUT")

If **type** is "SKIPPED":

- **num\_skipped** (u32): number of deleted/omitted entries

If **type** is "BROKEN", "UNUSUAL", "INFO" or "DEBUG":

- **time** (string): UNIX timestamp with 9 decimal places
- **source** (string): The particular logbook this was found in
- **log** (string): The actual log message
- **node\_id** (pubkey): The peer this is associated with

If **type** is "IO\_IN" or "IO\_OUT":

- **time** (string): UNIX timestamp with 9 decimal places
- **source** (string): The particular logbook this was found in
- **log** (string): The actual log message
- **node\_id** (pubkey): The peer this is associated with
- **data** (hex): The IO which occurred
- **channels** (array of objects, optional) **deprecated, removal in v23.11**:
- **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")
- **opener** (string): Who initiated the channel (one of "local", "remote")
- **features** (array of strings):
Expand Down Expand Up @@ -150,27 +171,6 @@ On success, an object containing **peers** is returned. It is an array of objec
- **initial\_feerate** (string): The feerate for the initial funding transaction in per-1000-weight, with "kpw" appended
- **last\_feerate** (string): The feerate for the latest funding transaction in per-1000-weight, with "kpw" appended
- **next\_feerate** (string): The minimum feerate for the next funding transaction in per-1000-weight, with "kpw" appended
- **log** (array of objects, optional): if *level* is specified, logs for this peer:
- **type** (string) (one of "SKIPPED", "BROKEN", "UNUSUAL", "INFO", "DEBUG", "IO\_IN", "IO\_OUT")

If **type** is "SKIPPED":

- **num\_skipped** (u32): number of deleted/omitted entries

If **type** is "BROKEN", "UNUSUAL", "INFO" or "DEBUG":

- **time** (string): UNIX timestamp with 9 decimal places
- **source** (string): The particular logbook this was found in
- **log** (string): The actual log message
- **node\_id** (pubkey): The peer this is associated with

If **type** is "IO\_IN" or "IO\_OUT":

- **time** (string): UNIX timestamp with 9 decimal places
- **source** (string): The particular logbook this was found in
- **log** (string): The actual log message
- **node\_id** (pubkey): The peer this is associated with
- **data** (hex): The IO which occurred

If **connected** is *true*:

Expand Down Expand Up @@ -399,4 +399,4 @@ Main web site: <https://github.com/ElementsProject/lightning> Lightning
RFC site (BOLT \#9):
<https://github.com/lightning/bolts/blob/master/09-features.md>

[comment]: # ( SHA256STAMP:c84136fcca3d0295cd1612873a54a074f3e8b6ae9cc643489cab6fb7376d66f6)
[comment]: # ( SHA256STAMP:a063a4a4fb1e6af4138d19ccbdc8d1539712c6eb6ed8a4b1b7f7c4fe12e0907b)
4 changes: 2 additions & 2 deletions doc/schemas/listpeers.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"additionalProperties": true,
"required": [
"id",
"connected",
"channels"
"connected"
],
"properties": {
"id": {
Expand Down Expand Up @@ -167,6 +166,7 @@
}
},
"channels": {
"deprecated": "v23.02",
"type": "array",
"items": {
"type": "object",
Expand Down
20 changes: 11 additions & 9 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1941,16 +1941,18 @@ static void json_add_peer(struct lightningd *ld,
json_add_hex_talarr(response, "features", p->their_features);
}

json_array_start(response, "channels");
json_add_uncommitted_channel(response, p->uncommitted_channel, NULL);

list_for_each(&p->channels, channel, list) {
if (channel_unsaved(channel))
json_add_unsaved_channel(response, channel, NULL);
else
json_add_channel(ld, response, NULL, channel, NULL);
if (deprecated_apis) {
json_array_start(response, "channels");
json_add_uncommitted_channel(response, p->uncommitted_channel, NULL);

list_for_each(&p->channels, channel, list) {
if (channel_unsaved(channel))
json_add_unsaved_channel(response, channel, NULL);
else
json_add_channel(ld, response, NULL, channel, NULL);
}
json_array_end(response);
}
json_array_end(response);

if (ll)
json_add_log(response, ld->log_book, &p->id, *ll);
Expand Down

0 comments on commit 6c0b9b0

Please sign in to comment.