diff --git a/.msggen.json b/.msggen.json index 550155b88..5f0ba8012 100644 --- a/.msggen.json +++ b/.msggen.json @@ -669,6 +669,7 @@ "ListPeers.peers[].netaddr[]": 5 }, "ListpeersPeersChannels": { + "ListPeers.peers[].channels[].alias": 50, "ListPeers.peers[].channels[].channel_id": 6, "ListPeers.peers[].channels[].close_to": 14, "ListPeers.peers[].channels[].close_to_addr": 47, @@ -719,6 +720,10 @@ "ListPeers.peers[].channels[].to_us_msat": 20, "ListPeers.peers[].channels[].total_msat": 23 }, + "ListpeersPeersChannelsAlias": { + "ListPeers.peers[].channels[].alias.local": 1, + "ListPeers.peers[].channels[].alias.remote": 2 + }, "ListpeersPeersChannelsFeerate": { "ListPeers.peers[].channels[].feerate.perkb": 2, "ListPeers.peers[].channels[].feerate.perkw": 1 diff --git a/cln-grpc/proto/node.proto b/cln-grpc/proto/node.proto index 3b96e9d52..228648010 100644 --- a/cln-grpc/proto/node.proto +++ b/cln-grpc/proto/node.proto @@ -234,6 +234,11 @@ message ListpeersPeersChannelsFunding { Amount pushed_msat = 3; } +message ListpeersPeersChannelsAlias { + optional string local = 1; + optional string remote = 2; +} + message ListpeersPeersChannelsHtlcs { // ListPeers.peers[].channels[].htlcs[].direction enum ListpeersPeersChannelsHtlcsDirection { diff --git a/cln-rpc/src/model.rs b/cln-rpc/src/model.rs index 75e5308ec..7bee25f88 100644 --- a/cln-rpc/src/model.rs +++ b/cln-rpc/src/model.rs @@ -1071,6 +1071,14 @@ pub mod responses { pub pushed_msat: Amount, } + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct ListpeersPeersChannelsAlias { + #[serde(alias = "local", skip_serializing_if = "Option::is_none")] + pub local: Option, + #[serde(alias = "remote", skip_serializing_if = "Option::is_none")] + pub remote: Option, + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeersPeersChannelsState_changes { #[serde(alias = "timestamp")] diff --git a/doc/lightning-listpeers.7.md b/doc/lightning-listpeers.7.md index d957fee47..170db4166 100644 --- a/doc/lightning-listpeers.7.md +++ b/doc/lightning-listpeers.7.md @@ -92,6 +92,9 @@ On success, an object containing **peers** is returned. It is an array of objec - **their_to_self_delay** (u32, optional): the number of blocks before they can take their funds if they unilateral close - **our_to_self_delay** (u32, optional): the number of blocks before we can take our funds if we unilateral close - **max_accepted_htlcs** (u32, optional): Maximum number of incoming HTLC we will accept at once + - **alias** (object, optional): + - **local** (short_channel_id, optional): An alias assigned by this node to this channel, used for outgoing payments + - **remote** (short_channel_id, optional): An alias assigned by the remote node to this channel, usable in routehints and invoices - **state_changes** (array of objects, optional): Prior state changes: - **timestamp** (string): UTC timestamp of form YYYY-mm-ddTHH:MM:SS.%03dZ - **old_state** (string): Previous state (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") @@ -381,4 +384,4 @@ Main web site: Lightning RFC site (BOLT \#9): -[comment]: # ( SHA256STAMP:2e8bcc66531b2dce44b94c42852b624bdd9435cc63495fc799458fa5522f0ea9) +[comment]: # ( SHA256STAMP:fcfc465cbbe95430f4fc6473099142c576883e333ef9fe31d04372f411e49f6d) diff --git a/doc/schemas/listpeers.schema.json b/doc/schemas/listpeers.schema.json index 2979f78cc..c526744f1 100644 --- a/doc/schemas/listpeers.schema.json +++ b/doc/schemas/listpeers.schema.json @@ -461,6 +461,20 @@ "htlc_minimum_msat": { "deprecated": true }, + "alias": { + "type": "object", + "required": [], + "properties": { + "local": { + "type": "short_channel_id", + "description": "An alias assigned by this node to this channel, used for outgoing payments" + }, + "remote": { + "type": "short_channel_id", + "description": "An alias assigned by the remote node to this channel, usable in routehints and invoices" + } + } + }, "state_changes": { "type": "array", "description": "Prior state changes", @@ -664,6 +678,7 @@ "payment_hash": {}, "local_trimmed": {}, "status": {}, + "alias": {}, "state": { "type": "string", "enum": [ @@ -751,6 +766,7 @@ "funding_outnum": {}, "close_to": {}, "private": {}, + "alias": {}, "opener": {}, "closer": {}, "features": {}, @@ -827,6 +843,7 @@ ], "properties": { "state": {}, + "alias": {}, "scratch_txid": {}, "feerate": {}, "owner": {}, @@ -911,6 +928,7 @@ "direction" ], "properties": { + "alias": {}, "state": {}, "scratch_txid": {}, "feerate": {}, @@ -1002,6 +1020,7 @@ "scratch_txid": {}, "feerate": {}, "owner": {}, + "alias": {}, "short_channel_id": {}, "channel_id": {}, "funding_txid": {}, diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index f68345b2f..6109ed895 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -744,6 +744,17 @@ static void json_add_channel(struct lightningd *ld, json_add_string(response, "closer", channel->closer == LOCAL ? "local" : "remote"); + if (channel->alias[LOCAL] || channel->alias[REMOTE]) { + json_object_start(response, "alias"); + if (channel->alias[LOCAL]) + json_add_short_channel_id(response, "local", + channel->alias[LOCAL]); + if (channel->alias[REMOTE]) + json_add_short_channel_id(response, "remote", + channel->alias[REMOTE]); + json_object_end(response); + } + json_array_start(response, "features"); if (channel_has(channel, OPT_STATIC_REMOTEKEY)) json_add_string(response, NULL, "option_static_remotekey");