Skip to content

Commit

Permalink
added listhtlcs model
Browse files Browse the repository at this point in the history
  • Loading branch information
ff authored and rustyrussell committed Jul 23, 2023
1 parent 5f65378 commit 6920e36
Show file tree
Hide file tree
Showing 12 changed files with 354 additions and 37 deletions.
81 changes: 81 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,32 @@
"spent": 2,
"unconfirmed": 0
},
"ListhtlcsHtlcsDirection": {
"in": 1,
"out": 0
},
"ListhtlcsHtlcsState": {
"RCVD_ADD_ACK_COMMIT": 3,
"RCVD_ADD_ACK_REVOCATION": 14,
"RCVD_ADD_COMMIT": 11,
"RCVD_ADD_HTLC": 10,
"RCVD_ADD_REVOCATION": 2,
"RCVD_REMOVE_ACK_COMMIT": 18,
"RCVD_REMOVE_ACK_REVOCATION": 9,
"RCVD_REMOVE_COMMIT": 6,
"RCVD_REMOVE_HTLC": 5,
"RCVD_REMOVE_REVOCATION": 17,
"SENT_ADD_ACK_COMMIT": 13,
"SENT_ADD_ACK_REVOCATION": 4,
"SENT_ADD_COMMIT": 1,
"SENT_ADD_HTLC": 0,
"SENT_ADD_REVOCATION": 12,
"SENT_REMOVE_ACK_COMMIT": 8,
"SENT_REMOVE_ACK_REVOCATION": 19,
"SENT_REMOVE_COMMIT": 16,
"SENT_REMOVE_HTLC": 15,
"SENT_REMOVE_REVOCATION": 7
},
"ListinvoicesIndex": {
"created": 0,
"updated": 1
Expand Down Expand Up @@ -925,6 +951,21 @@
"ListFunds.channels[]": 2,
"ListFunds.outputs[]": 1
},
"ListhtlcsHtlcs": {
"ListHtlcs.htlcs[].amount_msat": 4,
"ListHtlcs.htlcs[].direction": 5,
"ListHtlcs.htlcs[].expiry": 3,
"ListHtlcs.htlcs[].id": 2,
"ListHtlcs.htlcs[].payment_hash": 6,
"ListHtlcs.htlcs[].short_channel_id": 1,
"ListHtlcs.htlcs[].state": 7
},
"ListhtlcsRequest": {
"ListHtlcs.id": 1
},
"ListhtlcsResponse": {
"ListHtlcs.htlcs[]": 1
},
"ListinvoicesInvoices": {
"ListInvoices.invoices[].amount_msat": 6,
"ListInvoices.invoices[].amount_received_msat": 12,
Expand Down Expand Up @@ -3577,6 +3618,46 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"ListHtlcs": {
"added": "v23.02",
"deprecated": null
},
"ListHtlcs.htlcs[]": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ListHtlcs.htlcs[].amount_msat": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ListHtlcs.htlcs[].direction": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ListHtlcs.htlcs[].expiry": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ListHtlcs.htlcs[].id": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ListHtlcs.htlcs[].payment_hash": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ListHtlcs.htlcs[].short_channel_id": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ListHtlcs.htlcs[].state": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ListHtlcs.id": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ListInvoices": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
24 changes: 24 additions & 0 deletions cln-grpc/proto/node.proto

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

43 changes: 43 additions & 0 deletions cln-grpc/src/convert.rs

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

32 changes: 32 additions & 0 deletions cln-grpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,38 @@ async fn list_pays(

}

async fn list_htlcs(
&self,
request: tonic::Request<pb::ListhtlcsRequest>,
) -> Result<tonic::Response<pb::ListhtlcsResponse>, tonic::Status> {
let req = request.into_inner();
let req: requests::ListhtlcsRequest = req.into();
debug!("Client asked for list_htlcs");
trace!("list_htlcs 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::ListHtlcs(req))
.await
.map_err(|e| Status::new(
Code::Unknown,
format!("Error calling method ListHtlcs: {:?}", e)))?;
match result {
Response::ListHtlcs(r) => {
trace!("list_htlcs response: {:?}", r);
Ok(tonic::Response::new(r.into()))
},
r => Err(Status::new(
Code::Internal,
format!(
"Unexpected result {:?} to method call ListHtlcs",
r
)
)),
}

}

async fn ping(
&self,
request: tonic::Request<pb::PingRequest>,
Expand Down
76 changes: 76 additions & 0 deletions cln-rpc/src/model.rs

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

Binary file added contrib/msggen/dist/msggen-0.1.0.tar.gz
Binary file not shown.
Empty file.
1 change: 1 addition & 0 deletions contrib/msggen/msggen/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class OverridePatch(Patch):
'ListPeers.peers[].channels[].state_changes[].old_state': "ChannelState",
'ListPeers.peers[].channels[].htlcs[].state': "HtlcState",
'ListPeerChannels.channels[].htlcs[].state': "HtlcState",
'ListHtlcs.htlcs[].state': "HtlcState",
}

def visit(self, f: model.Field) -> None:
Expand Down
1 change: 1 addition & 0 deletions contrib/msggen/msggen/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def load_jsonrpc_service(schema_dir: str):
"ListForwards",
# "listoffers",
"ListPays",
"ListHtlcs",
# "multifundchannel",
# "multiwithdraw",
# "offer",
Expand Down
82 changes: 45 additions & 37 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

Loading

0 comments on commit 6920e36

Please sign in to comment.