mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
lightningd: deprecate listpeers.channels
Changelog-Deprecated: JSON-RPC: `listpeers` `channels` array: use `listpeerchannels` Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commit is contained in:
parent
9ffaab7d22
commit
6c0b9b0c78
5 changed files with 39 additions and 36 deletions
2
cln-grpc/src/convert.rs
generated
2
cln-grpc/src/convert.rs
generated
|
@ -216,7 +216,7 @@ impl From<responses::ListpeersPeers> for pb::ListpeersPeers {
|
|||
id: c.id.serialize().to_vec(), // Rule #2 for type pubkey
|
||||
connected: c.connected, // Rule #2 for type boolean
|
||||
log: c.log.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
|
||||
channels: c.channels.into_iter().map(|i| i.into()).collect(), // Rule #3 for type ListpeersPeersChannels
|
||||
channels: c.channels.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
|
||||
netaddr: c.netaddr.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
|
||||
remote_addr: c.remote_addr, // Rule #2 for type string?
|
||||
features: c.features.map(|v| hex::decode(v).unwrap()), // Rule #2 for type hex?
|
||||
|
|
5
cln-rpc/src/model.rs
generated
5
cln-rpc/src/model.rs
generated
|
@ -1808,8 +1808,9 @@ pub mod responses {
|
|||
pub connected: bool,
|
||||
#[serde(alias = "log", skip_serializing_if = "crate::is_none_or_empty")]
|
||||
pub log: Option<Vec<ListpeersPeersLog>>,
|
||||
#[serde(alias = "channels")]
|
||||
pub channels: Vec<ListpeersPeersChannels>,
|
||||
#[deprecated]
|
||||
#[serde(alias = "channels", skip_serializing_if = "crate::is_none_or_empty")]
|
||||
pub channels: Option<Vec<ListpeersPeersChannels>>,
|
||||
#[serde(alias = "netaddr", skip_serializing_if = "crate::is_none_or_empty")]
|
||||
pub netaddr: Option<Vec<String>>,
|
||||
#[serde(alias = "remote_addr", skip_serializing_if = "Option::is_none")]
|
||||
|
|
|
@ -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):
|
||||
|
@ -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*:
|
||||
|
||||
|
@ -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)
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
"additionalProperties": true,
|
||||
"required": [
|
||||
"id",
|
||||
"connected",
|
||||
"channels"
|
||||
"connected"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
|
@ -167,6 +166,7 @@
|
|||
}
|
||||
},
|
||||
"channels": {
|
||||
"deprecated": "v23.02",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
|
|
|
@ -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);
|
||||
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);
|
||||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue