mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 22:31:48 +01:00
msggen: Add ListClosedChannels and overrides
This commit is contained in:
parent
318f35b243
commit
bff3b1ca8c
12 changed files with 680 additions and 84 deletions
168
.msggen.json
168
.msggen.json
|
@ -58,6 +58,14 @@
|
|||
"KeysendStatus": {
|
||||
"complete": 0
|
||||
},
|
||||
"ListclosedchannelsClosedchannelsClose_cause": {
|
||||
"local": 1,
|
||||
"onchain": 5,
|
||||
"protocol": 4,
|
||||
"remote": 3,
|
||||
"unknown": 0,
|
||||
"user": 2
|
||||
},
|
||||
"ListforwardsForwardsStatus": {
|
||||
"failed": 3,
|
||||
"local_failed": 2,
|
||||
|
@ -649,6 +657,42 @@
|
|||
"ListchannelsResponse": {
|
||||
"ListChannels.channels[]": 1
|
||||
},
|
||||
"ListclosedchannelsClosedchannels": {
|
||||
"ListClosedChannels.closedchannels[].alias": 4,
|
||||
"ListClosedChannels.closedchannels[].channel_id": 2,
|
||||
"ListClosedChannels.closedchannels[].channel_type": 8,
|
||||
"ListClosedChannels.closedchannels[].close_cause": 24,
|
||||
"ListClosedChannels.closedchannels[].closer": 6,
|
||||
"ListClosedChannels.closedchannels[].final_to_us_msat": 19,
|
||||
"ListClosedChannels.closedchannels[].funding_fee_paid_msat": 15,
|
||||
"ListClosedChannels.closedchannels[].funding_fee_rcvd_msat": 16,
|
||||
"ListClosedChannels.closedchannels[].funding_outnum": 13,
|
||||
"ListClosedChannels.closedchannels[].funding_pushed_msat": 17,
|
||||
"ListClosedChannels.closedchannels[].funding_txid": 12,
|
||||
"ListClosedChannels.closedchannels[].last_commitment_fee_msat": 23,
|
||||
"ListClosedChannels.closedchannels[].last_commitment_txid": 22,
|
||||
"ListClosedChannels.closedchannels[].leased": 14,
|
||||
"ListClosedChannels.closedchannels[].max_to_us_msat": 21,
|
||||
"ListClosedChannels.closedchannels[].min_to_us_msat": 20,
|
||||
"ListClosedChannels.closedchannels[].opener": 5,
|
||||
"ListClosedChannels.closedchannels[].peer_id": 1,
|
||||
"ListClosedChannels.closedchannels[].private": 7,
|
||||
"ListClosedChannels.closedchannels[].short_channel_id": 3,
|
||||
"ListClosedChannels.closedchannels[].total_htlcs_sent": 11,
|
||||
"ListClosedChannels.closedchannels[].total_local_commitments": 9,
|
||||
"ListClosedChannels.closedchannels[].total_msat": 18,
|
||||
"ListClosedChannels.closedchannels[].total_remote_commitments": 10
|
||||
},
|
||||
"ListclosedchannelsClosedchannelsAlias": {
|
||||
"ListClosedChannels.closedchannels[].alias.local": 1,
|
||||
"ListClosedChannels.closedchannels[].alias.remote": 2
|
||||
},
|
||||
"ListclosedchannelsRequest": {
|
||||
"ListClosedChannels.id": 1
|
||||
},
|
||||
"ListclosedchannelsResponse": {
|
||||
"ListClosedChannels.closedchannels[]": 1
|
||||
},
|
||||
"ListdatastoreDatastore": {
|
||||
"ListDatastore.datastore[].generation": 2,
|
||||
"ListDatastore.datastore[].hex": 3,
|
||||
|
@ -2402,6 +2446,130 @@
|
|||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels": {
|
||||
"added": "v23.05",
|
||||
"deprecated": null
|
||||
},
|
||||
"ListClosedChannels.closedchannels[]": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].alias": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].alias.local": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].alias.remote": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].channel_id": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].channel_type": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].channel_type.bits[]": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].channel_type.names[]": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].close_cause": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].closer": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].final_to_us_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].funding_fee_paid_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].funding_fee_rcvd_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].funding_outnum": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].funding_pushed_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].funding_txid": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].last_commitment_fee_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].last_commitment_txid": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].leased": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].max_to_us_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].min_to_us_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].opener": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].peer_id": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].private": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].short_channel_id": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].total_htlcs_sent": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].total_local_commitments": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].total_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.closedchannels[].total_remote_commitments": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListClosedChannels.id": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"ListDatastore": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": null
|
||||
|
|
49
cln-grpc/proto/node.proto
generated
49
cln-grpc/proto/node.proto
generated
|
@ -46,6 +46,7 @@ service Node {
|
|||
rpc TxPrepare(TxprepareRequest) returns (TxprepareResponse) {}
|
||||
rpc TxSend(TxsendRequest) returns (TxsendResponse) {}
|
||||
rpc ListPeerChannels(ListpeerchannelsRequest) returns (ListpeerchannelsResponse) {}
|
||||
rpc ListClosedChannels(ListclosedchannelsRequest) returns (ListclosedchannelsResponse) {}
|
||||
rpc Disconnect(DisconnectRequest) returns (DisconnectResponse) {}
|
||||
rpc Feerates(FeeratesRequest) returns (FeeratesResponse) {}
|
||||
rpc FundChannel(FundchannelRequest) returns (FundchannelResponse) {}
|
||||
|
@ -1221,6 +1222,54 @@ message ListpeerchannelsChannelsHtlcs {
|
|||
optional string status = 7;
|
||||
}
|
||||
|
||||
message ListclosedchannelsRequest {
|
||||
optional bytes id = 1;
|
||||
}
|
||||
|
||||
message ListclosedchannelsResponse {
|
||||
repeated ListclosedchannelsClosedchannels closedchannels = 1;
|
||||
}
|
||||
|
||||
message ListclosedchannelsClosedchannels {
|
||||
// ListClosedChannels.closedchannels[].close_cause
|
||||
enum ListclosedchannelsClosedchannelsClose_cause {
|
||||
UNKNOWN = 0;
|
||||
LOCAL = 1;
|
||||
USER = 2;
|
||||
REMOTE = 3;
|
||||
PROTOCOL = 4;
|
||||
ONCHAIN = 5;
|
||||
}
|
||||
optional bytes peer_id = 1;
|
||||
bytes channel_id = 2;
|
||||
optional string short_channel_id = 3;
|
||||
optional ListclosedchannelsClosedchannelsAlias alias = 4;
|
||||
ChannelSide opener = 5;
|
||||
optional ChannelSide closer = 6;
|
||||
bool private = 7;
|
||||
uint64 total_local_commitments = 9;
|
||||
uint64 total_remote_commitments = 10;
|
||||
uint64 total_htlcs_sent = 11;
|
||||
bytes funding_txid = 12;
|
||||
uint32 funding_outnum = 13;
|
||||
bool leased = 14;
|
||||
optional Amount funding_fee_paid_msat = 15;
|
||||
optional Amount funding_fee_rcvd_msat = 16;
|
||||
optional Amount funding_pushed_msat = 17;
|
||||
Amount total_msat = 18;
|
||||
Amount final_to_us_msat = 19;
|
||||
Amount min_to_us_msat = 20;
|
||||
Amount max_to_us_msat = 21;
|
||||
optional bytes last_commitment_txid = 22;
|
||||
optional Amount last_commitment_fee_msat = 23;
|
||||
ListclosedchannelsClosedchannelsClose_cause close_cause = 24;
|
||||
}
|
||||
|
||||
message ListclosedchannelsClosedchannelsAlias {
|
||||
optional string local = 1;
|
||||
optional string remote = 2;
|
||||
}
|
||||
|
||||
message DisconnectRequest {
|
||||
bytes id = 1;
|
||||
optional bool force = 2;
|
||||
|
|
68
cln-grpc/src/convert.rs
generated
68
cln-grpc/src/convert.rs
generated
|
@ -1036,6 +1036,56 @@ impl From<responses::ListpeerchannelsResponse> for pb::ListpeerchannelsResponse
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables,deprecated)]
|
||||
impl From<responses::ListclosedchannelsClosedchannelsAlias> for pb::ListclosedchannelsClosedchannelsAlias {
|
||||
fn from(c: responses::ListclosedchannelsClosedchannelsAlias) -> Self {
|
||||
Self {
|
||||
local: c.local.map(|v| v.to_string()), // Rule #2 for type short_channel_id?
|
||||
remote: c.remote.map(|v| v.to_string()), // Rule #2 for type short_channel_id?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables,deprecated)]
|
||||
impl From<responses::ListclosedchannelsClosedchannels> for pb::ListclosedchannelsClosedchannels {
|
||||
fn from(c: responses::ListclosedchannelsClosedchannels) -> Self {
|
||||
Self {
|
||||
peer_id: c.peer_id.map(|v| v.serialize().to_vec()), // Rule #2 for type pubkey?
|
||||
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?
|
||||
alias: c.alias.map(|v| v.into()),
|
||||
opener: c.opener as i32,
|
||||
closer: c.closer.map(|v| v as i32),
|
||||
private: c.private, // Rule #2 for type boolean
|
||||
total_local_commitments: c.total_local_commitments, // Rule #2 for type u64
|
||||
total_remote_commitments: c.total_remote_commitments, // Rule #2 for type u64
|
||||
total_htlcs_sent: c.total_htlcs_sent, // Rule #2 for type u64
|
||||
funding_txid: hex::decode(&c.funding_txid).unwrap(), // Rule #2 for type txid
|
||||
funding_outnum: c.funding_outnum, // Rule #2 for type u32
|
||||
leased: c.leased, // Rule #2 for type boolean
|
||||
funding_fee_paid_msat: c.funding_fee_paid_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
funding_fee_rcvd_msat: c.funding_fee_rcvd_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
funding_pushed_msat: c.funding_pushed_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
total_msat: Some(c.total_msat.into()), // Rule #2 for type msat
|
||||
final_to_us_msat: Some(c.final_to_us_msat.into()), // Rule #2 for type msat
|
||||
min_to_us_msat: Some(c.min_to_us_msat.into()), // Rule #2 for type msat
|
||||
max_to_us_msat: Some(c.max_to_us_msat.into()), // Rule #2 for type msat
|
||||
last_commitment_txid: c.last_commitment_txid.map(|v| v.to_vec()), // Rule #2 for type hash?
|
||||
last_commitment_fee_msat: c.last_commitment_fee_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
close_cause: c.close_cause as i32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables,deprecated)]
|
||||
impl From<responses::ListclosedchannelsResponse> for pb::ListclosedchannelsResponse {
|
||||
fn from(c: responses::ListclosedchannelsResponse) -> Self {
|
||||
Self {
|
||||
closedchannels: c.closedchannels.into_iter().map(|i| i.into()).collect(), // Rule #3 for type ListclosedchannelsClosedchannels
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables,deprecated)]
|
||||
impl From<responses::DisconnectResponse> for pb::DisconnectResponse {
|
||||
fn from(c: responses::DisconnectResponse) -> Self {
|
||||
|
@ -1773,6 +1823,15 @@ impl From<requests::ListpeerchannelsRequest> for pb::ListpeerchannelsRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables,deprecated)]
|
||||
impl From<requests::ListclosedchannelsRequest> for pb::ListclosedchannelsRequest {
|
||||
fn from(c: requests::ListclosedchannelsRequest) -> Self {
|
||||
Self {
|
||||
id: c.id.map(|v| v.serialize().to_vec()), // Rule #2 for type pubkey?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables,deprecated)]
|
||||
impl From<requests::DisconnectRequest> for pb::DisconnectRequest {
|
||||
fn from(c: requests::DisconnectRequest) -> Self {
|
||||
|
@ -2389,6 +2448,15 @@ impl From<pb::ListpeerchannelsRequest> for requests::ListpeerchannelsRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables,deprecated)]
|
||||
impl From<pb::ListclosedchannelsRequest> for requests::ListclosedchannelsRequest {
|
||||
fn from(c: pb::ListclosedchannelsRequest) -> Self {
|
||||
Self {
|
||||
id: c.id.map(|v| PublicKey::from_slice(&v).unwrap()), // Rule #1 for type pubkey?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables,deprecated)]
|
||||
impl From<pb::DisconnectRequest> for requests::DisconnectRequest {
|
||||
fn from(c: pb::DisconnectRequest) -> Self {
|
||||
|
|
|
@ -1242,6 +1242,38 @@ async fn list_peer_channels(
|
|||
|
||||
}
|
||||
|
||||
async fn list_closed_channels(
|
||||
&self,
|
||||
request: tonic::Request<pb::ListclosedchannelsRequest>,
|
||||
) -> Result<tonic::Response<pb::ListclosedchannelsResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::ListclosedchannelsRequest = req.into();
|
||||
debug!("Client asked for list_closed_channels");
|
||||
trace!("list_closed_channels request: {:?}", req);
|
||||
let mut rpc = ClnRpc::new(&self.rpc_path)
|
||||
.await
|
||||
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
|
||||
let result = rpc.call(Request::ListClosedChannels(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method ListClosedChannels: {:?}", e)))?;
|
||||
match result {
|
||||
Response::ListClosedChannels(r) => {
|
||||
trace!("list_closed_channels response: {:?}", r);
|
||||
Ok(tonic::Response::new(r.into()))
|
||||
},
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call ListClosedChannels",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn disconnect(
|
||||
&self,
|
||||
request: tonic::Request<pb::DisconnectRequest>,
|
||||
|
|
147
cln-rpc/src/model.rs
generated
147
cln-rpc/src/model.rs
generated
|
@ -54,6 +54,7 @@ pub enum Request {
|
|||
TxPrepare(requests::TxprepareRequest),
|
||||
TxSend(requests::TxsendRequest),
|
||||
ListPeerChannels(requests::ListpeerchannelsRequest),
|
||||
ListClosedChannels(requests::ListclosedchannelsRequest),
|
||||
Disconnect(requests::DisconnectRequest),
|
||||
Feerates(requests::FeeratesRequest),
|
||||
FundChannel(requests::FundchannelRequest),
|
||||
|
@ -110,6 +111,7 @@ pub enum Response {
|
|||
TxPrepare(responses::TxprepareResponse),
|
||||
TxSend(responses::TxsendResponse),
|
||||
ListPeerChannels(responses::ListpeerchannelsResponse),
|
||||
ListClosedChannels(responses::ListclosedchannelsResponse),
|
||||
Disconnect(responses::DisconnectResponse),
|
||||
Feerates(responses::FeeratesResponse),
|
||||
FundChannel(responses::FundchannelResponse),
|
||||
|
@ -1020,6 +1022,22 @@ pub mod requests {
|
|||
type Response = super::responses::ListpeerchannelsResponse;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ListclosedchannelsRequest {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<PublicKey>,
|
||||
}
|
||||
|
||||
impl From<ListclosedchannelsRequest> for Request {
|
||||
fn from(r: ListclosedchannelsRequest) -> Self {
|
||||
Request::ListClosedChannels(r)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoRequest for ListclosedchannelsRequest {
|
||||
type Response = super::responses::ListclosedchannelsResponse;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct DisconnectRequest {
|
||||
pub id: PublicKey,
|
||||
|
@ -3757,6 +3775,135 @@ pub mod responses {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ListclosedchannelsClosedchannelsAlias {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub local: Option<ShortChannelId>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub remote: Option<ShortChannelId>,
|
||||
}
|
||||
|
||||
/// Name of feature bit
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
||||
pub enum ListclosedchannelsClosedchannelsChannel_typeNames {
|
||||
#[serde(rename = "static_remotekey/even")]
|
||||
STATIC_REMOTEKEY_EVEN,
|
||||
#[serde(rename = "anchor_outputs/even")]
|
||||
ANCHOR_OUTPUTS_EVEN,
|
||||
#[serde(rename = "anchors_zero_fee_htlc_tx/even")]
|
||||
ANCHORS_ZERO_FEE_HTLC_TX_EVEN,
|
||||
#[serde(rename = "scid_alias/even")]
|
||||
SCID_ALIAS_EVEN,
|
||||
#[serde(rename = "zeroconf/even")]
|
||||
ZEROCONF_EVEN,
|
||||
}
|
||||
|
||||
impl TryFrom<i32> for ListclosedchannelsClosedchannelsChannel_typeNames {
|
||||
type Error = anyhow::Error;
|
||||
fn try_from(c: i32) -> Result<ListclosedchannelsClosedchannelsChannel_typeNames, anyhow::Error> {
|
||||
match c {
|
||||
0 => Ok(ListclosedchannelsClosedchannelsChannel_typeNames::STATIC_REMOTEKEY_EVEN),
|
||||
1 => Ok(ListclosedchannelsClosedchannelsChannel_typeNames::ANCHOR_OUTPUTS_EVEN),
|
||||
2 => Ok(ListclosedchannelsClosedchannelsChannel_typeNames::ANCHORS_ZERO_FEE_HTLC_TX_EVEN),
|
||||
3 => Ok(ListclosedchannelsClosedchannelsChannel_typeNames::SCID_ALIAS_EVEN),
|
||||
4 => Ok(ListclosedchannelsClosedchannelsChannel_typeNames::ZEROCONF_EVEN),
|
||||
o => Err(anyhow::anyhow!("Unknown variant {} for enum ListclosedchannelsClosedchannelsChannel_typeNames", o)),
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ListclosedchannelsClosedchannelsChannel_type {
|
||||
pub bits: Vec<u32>,
|
||||
pub names: Vec<ListclosedchannelsClosedchannelsChannel_typeNames>,
|
||||
}
|
||||
|
||||
/// What caused the channel to close
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
||||
pub enum ListclosedchannelsClosedchannelsClose_cause {
|
||||
#[serde(rename = "unknown")]
|
||||
UNKNOWN,
|
||||
#[serde(rename = "local")]
|
||||
LOCAL,
|
||||
#[serde(rename = "user")]
|
||||
USER,
|
||||
#[serde(rename = "remote")]
|
||||
REMOTE,
|
||||
#[serde(rename = "protocol")]
|
||||
PROTOCOL,
|
||||
#[serde(rename = "onchain")]
|
||||
ONCHAIN,
|
||||
}
|
||||
|
||||
impl TryFrom<i32> for ListclosedchannelsClosedchannelsClose_cause {
|
||||
type Error = anyhow::Error;
|
||||
fn try_from(c: i32) -> Result<ListclosedchannelsClosedchannelsClose_cause, anyhow::Error> {
|
||||
match c {
|
||||
0 => Ok(ListclosedchannelsClosedchannelsClose_cause::UNKNOWN),
|
||||
1 => Ok(ListclosedchannelsClosedchannelsClose_cause::LOCAL),
|
||||
2 => Ok(ListclosedchannelsClosedchannelsClose_cause::USER),
|
||||
3 => Ok(ListclosedchannelsClosedchannelsClose_cause::REMOTE),
|
||||
4 => Ok(ListclosedchannelsClosedchannelsClose_cause::PROTOCOL),
|
||||
5 => Ok(ListclosedchannelsClosedchannelsClose_cause::ONCHAIN),
|
||||
o => Err(anyhow::anyhow!("Unknown variant {} for enum ListclosedchannelsClosedchannelsClose_cause", o)),
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ListclosedchannelsClosedchannels {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub peer_id: Option<PublicKey>,
|
||||
pub channel_id: Sha256,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub short_channel_id: Option<ShortChannelId>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub alias: Option<ListclosedchannelsClosedchannelsAlias>,
|
||||
// Path `ListClosedChannels.closedchannels[].opener`
|
||||
pub opener: ChannelSide,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub closer: Option<ChannelSide>,
|
||||
pub private: bool,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub channel_type: Option<ListclosedchannelsClosedchannelsChannel_type>,
|
||||
pub total_local_commitments: u64,
|
||||
pub total_remote_commitments: u64,
|
||||
pub total_htlcs_sent: u64,
|
||||
pub funding_txid: String,
|
||||
pub funding_outnum: u32,
|
||||
pub leased: bool,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub funding_fee_paid_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub funding_fee_rcvd_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub funding_pushed_msat: Option<Amount>,
|
||||
pub total_msat: Amount,
|
||||
pub final_to_us_msat: Amount,
|
||||
pub min_to_us_msat: Amount,
|
||||
pub max_to_us_msat: Amount,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub last_commitment_txid: Option<Sha256>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub last_commitment_fee_msat: Option<Amount>,
|
||||
// Path `ListClosedChannels.closedchannels[].close_cause`
|
||||
pub close_cause: ListclosedchannelsClosedchannelsClose_cause,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ListclosedchannelsResponse {
|
||||
pub closedchannels: Vec<ListclosedchannelsClosedchannels>,
|
||||
}
|
||||
|
||||
impl TryFrom<Response> for ListclosedchannelsResponse {
|
||||
type Error = super::TryFromResponseError;
|
||||
|
||||
fn try_from(response: Response) -> Result<Self, Self::Error> {
|
||||
match response {
|
||||
Response::ListClosedChannels(response) => Ok(response),
|
||||
_ => Err(TryFromResponseError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct DisconnectResponse {
|
||||
}
|
||||
|
|
|
@ -50,6 +50,10 @@ overrides = {
|
|||
'ListPeerChannels.channels[].channel_type': None,
|
||||
'ListFunds.channels[].state': 'ChannelState',
|
||||
'ListTransactions.transactions[].type[]': None,
|
||||
|
||||
'ListClosedChannels.closedchannels[].closer': "ChannelSide",
|
||||
'ListClosedChannels.closedchannels[].opener': "ChannelSide",
|
||||
'ListClosedChannels.closedchannels[].channel_type': None,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@ overrides = {
|
|||
'ListFunds.channels[].state': 'ChannelState',
|
||||
'ListTransactions.transactions[].type[]': None,
|
||||
'Invoice.exposeprivatechannels': None,
|
||||
|
||||
'ListClosedChannels.closedchannels[].closer': "ChannelSide",
|
||||
'ListClosedChannels.closedchannels[].opener': "ChannelSide",
|
||||
'ListClosedChannels.closedchannels[].channel_type': None,
|
||||
}
|
||||
|
||||
# A map of schema type to rust primitive types.
|
||||
|
|
|
@ -62,7 +62,7 @@ class VersionAnnotationPatch(Patch):
|
|||
# the default value only on the first run. Code left commented
|
||||
# to show how it was done
|
||||
# if f.added is None and 'added' not in m:
|
||||
# m['added'] = 'pre-v0.10.1'
|
||||
# m['added'] = 'pre-v0.10.1'
|
||||
|
||||
added = m.get('added', None)
|
||||
deprecated = m.get('deprecated', None)
|
||||
|
|
|
@ -65,6 +65,7 @@ def load_jsonrpc_service(schema_dir: str):
|
|||
"TxPrepare",
|
||||
"TxSend",
|
||||
"ListPeerChannels",
|
||||
"ListClosedChannels",
|
||||
# "decodepay",
|
||||
# "decode",
|
||||
# "delpay",
|
||||
|
|
|
@ -847,6 +847,53 @@ def listpeerchannels2py(m):
|
|||
})
|
||||
|
||||
|
||||
def listclosedchannels_closedchannels_alias2py(m):
|
||||
return remove_default({
|
||||
"local": m.local, # PrimitiveField in generate_composite
|
||||
"remote": m.remote, # PrimitiveField in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def listclosedchannels_closedchannels_channel_type2py(m):
|
||||
return remove_default({
|
||||
"bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite
|
||||
"names": [str(i) for i in m.names], # ArrayField[composite] in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def listclosedchannels_closedchannels2py(m):
|
||||
return remove_default({
|
||||
"peer_id": hexlify(m.peer_id), # PrimitiveField in generate_composite
|
||||
"channel_id": hexlify(m.channel_id), # PrimitiveField in generate_composite
|
||||
"short_channel_id": m.short_channel_id, # PrimitiveField in generate_composite
|
||||
"opener": str(m.opener), # EnumField in generate_composite
|
||||
"closer": str(m.closer), # EnumField in generate_composite
|
||||
"private": m.private, # PrimitiveField in generate_composite
|
||||
"total_local_commitments": m.total_local_commitments, # PrimitiveField in generate_composite
|
||||
"total_remote_commitments": m.total_remote_commitments, # PrimitiveField in generate_composite
|
||||
"total_htlcs_sent": m.total_htlcs_sent, # PrimitiveField in generate_composite
|
||||
"funding_txid": hexlify(m.funding_txid), # PrimitiveField in generate_composite
|
||||
"funding_outnum": m.funding_outnum, # PrimitiveField in generate_composite
|
||||
"leased": m.leased, # PrimitiveField in generate_composite
|
||||
"funding_fee_paid_msat": amount2msat(m.funding_fee_paid_msat), # PrimitiveField in generate_composite
|
||||
"funding_fee_rcvd_msat": amount2msat(m.funding_fee_rcvd_msat), # PrimitiveField in generate_composite
|
||||
"funding_pushed_msat": amount2msat(m.funding_pushed_msat), # PrimitiveField in generate_composite
|
||||
"total_msat": amount2msat(m.total_msat), # PrimitiveField in generate_composite
|
||||
"final_to_us_msat": amount2msat(m.final_to_us_msat), # PrimitiveField in generate_composite
|
||||
"min_to_us_msat": amount2msat(m.min_to_us_msat), # PrimitiveField in generate_composite
|
||||
"max_to_us_msat": amount2msat(m.max_to_us_msat), # PrimitiveField in generate_composite
|
||||
"last_commitment_txid": hexlify(m.last_commitment_txid), # PrimitiveField in generate_composite
|
||||
"last_commitment_fee_msat": amount2msat(m.last_commitment_fee_msat), # PrimitiveField in generate_composite
|
||||
"close_cause": str(m.close_cause), # EnumField in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def listclosedchannels2py(m):
|
||||
return remove_default({
|
||||
"closedchannels": [listclosedchannels_closedchannels2py(i) for i in m.closedchannels], # ArrayField[composite] in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def disconnect2py(m):
|
||||
return remove_default({
|
||||
})
|
||||
|
|
209
contrib/pyln-testing/pyln/testing/node_pb2.py
generated
209
contrib/pyln-testing/pyln/testing/node_pb2.py
generated
File diff suppressed because one or more lines are too long
|
@ -204,6 +204,11 @@ class NodeStub(object):
|
|||
request_serializer=node__pb2.ListpeerchannelsRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.ListpeerchannelsResponse.FromString,
|
||||
)
|
||||
self.ListClosedChannels = channel.unary_unary(
|
||||
'/cln.Node/ListClosedChannels',
|
||||
request_serializer=node__pb2.ListclosedchannelsRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.ListclosedchannelsResponse.FromString,
|
||||
)
|
||||
self.Disconnect = channel.unary_unary(
|
||||
'/cln.Node/Disconnect',
|
||||
request_serializer=node__pb2.DisconnectRequest.SerializeToString,
|
||||
|
@ -497,6 +502,12 @@ class NodeServicer(object):
|
|||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def ListClosedChannels(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def Disconnect(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
|
@ -762,6 +773,11 @@ def add_NodeServicer_to_server(servicer, server):
|
|||
request_deserializer=node__pb2.ListpeerchannelsRequest.FromString,
|
||||
response_serializer=node__pb2.ListpeerchannelsResponse.SerializeToString,
|
||||
),
|
||||
'ListClosedChannels': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.ListClosedChannels,
|
||||
request_deserializer=node__pb2.ListclosedchannelsRequest.FromString,
|
||||
response_serializer=node__pb2.ListclosedchannelsResponse.SerializeToString,
|
||||
),
|
||||
'Disconnect': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.Disconnect,
|
||||
request_deserializer=node__pb2.DisconnectRequest.FromString,
|
||||
|
@ -1478,6 +1494,23 @@ class Node(object):
|
|||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def ListClosedChannels(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(request, target, '/cln.Node/ListClosedChannels',
|
||||
node__pb2.ListclosedchannelsRequest.SerializeToString,
|
||||
node__pb2.ListclosedchannelsResponse.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def Disconnect(request,
|
||||
target,
|
||||
|
|
Loading…
Add table
Reference in a new issue