mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
Output channel_id in listfunds
Changelog-Added: JSON-RPC: `listfunds` now has a `channel_id` field.
This commit is contained in:
committed by
Vincenzo Palazzo
parent
fca62113f5
commit
906279a46e
@@ -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,
|
||||
|
||||
1
cln-grpc/proto/node.proto
generated
1
cln-grpc/proto/node.proto
generated
@@ -303,6 +303,7 @@ message ListfundsChannels {
|
||||
uint32 funding_output = 5;
|
||||
bool connected = 6;
|
||||
ChannelState state = 7;
|
||||
bytes channel_id = 9;
|
||||
optional string short_channel_id = 8;
|
||||
}
|
||||
|
||||
|
||||
2
cln-grpc/src/convert.rs
generated
2
cln-grpc/src/convert.rs
generated
@@ -259,6 +259,7 @@ impl From<responses::ListfundsChannels> for pb::ListfundsChannels {
|
||||
funding_output: c.funding_output, // Rule #2 for type u32
|
||||
connected: c.connected, // Rule #2 for type boolean
|
||||
state: c.state as i32,
|
||||
channel_id: c.channel_id.to_vec(), // Rule #2 for type hash
|
||||
short_channel_id: c.short_channel_id.map(|v| v.to_string()), // Rule #2 for type short_channel_id?
|
||||
}
|
||||
}
|
||||
@@ -2595,6 +2596,7 @@ impl From<pb::ListfundsChannels> for responses::ListfundsChannels {
|
||||
funding_output: c.funding_output, // Rule #1 for type u32
|
||||
connected: c.connected, // Rule #1 for type boolean
|
||||
state: c.state.try_into().unwrap(),
|
||||
channel_id: Sha256::from_slice(&c.channel_id).unwrap(), // Rule #1 for type hash
|
||||
short_channel_id: c.short_channel_id.map(|v| cln_rpc::primitives::ShortChannelId::from_str(&v).unwrap()), // Rule #1 for type short_channel_id?
|
||||
}
|
||||
}
|
||||
|
||||
1
cln-rpc/src/model.rs
generated
1
cln-rpc/src/model.rs
generated
@@ -1809,6 +1809,7 @@ pub mod responses {
|
||||
pub connected: bool,
|
||||
// Path `ListFunds.channels[].state`
|
||||
pub state: ChannelState,
|
||||
pub channel_id: Sha256,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub short_channel_id: Option<ShortChannelId>,
|
||||
}
|
||||
|
||||
@@ -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
|
||||
})
|
||||
|
||||
|
||||
@@ -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":
|
||||
|
||||
@@ -73,4 +74,4 @@ RESOURCES
|
||||
|
||||
Main web site: <https://github.com/ElementsProject/lightning>
|
||||
|
||||
[comment]: # ( SHA256STAMP:3282d4025e161d6926878a5fc8d78384784885749630f007cc5dfcd8d2794b10)
|
||||
[comment]: # ( SHA256STAMP:ae6228c9cc323e0b6486eb4d2695105b087e98770763c6f9e5af3b888fa9520f)
|
||||
|
||||
@@ -143,7 +143,8 @@
|
||||
"funding_txid",
|
||||
"funding_output",
|
||||
"connected",
|
||||
"state"
|
||||
"state",
|
||||
"channel_id"
|
||||
],
|
||||
"properties": {
|
||||
"peer_id": {
|
||||
@@ -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": [
|
||||
@@ -215,6 +221,7 @@
|
||||
"funding_output": {},
|
||||
"connected": {},
|
||||
"state": {},
|
||||
"channel_id": {},
|
||||
"short_channel_id": {
|
||||
"type": "short_channel_id",
|
||||
"description": "short channel id of channel"
|
||||
@@ -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)"
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user