Skip to content

Commit

Permalink
msggen: add dev-forget-channel method
Browse files Browse the repository at this point in the history
Changelog-None
  • Loading branch information
daywalker90 authored and cdecker committed May 16, 2024
1 parent 934b85a commit b8a6512
Show file tree
Hide file tree
Showing 9 changed files with 797 additions and 577 deletions.
43 changes: 43 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,17 @@
"DelpayResponse": {
"DelPay.payments[]": 1
},
"Dev-forget-channelRequest": {
"Dev-Forget-Channel.channel_id": 3,
"Dev-Forget-Channel.force": 4,
"Dev-Forget-Channel.id": 1,
"Dev-Forget-Channel.short_channel_id": 2
},
"Dev-forget-channelResponse": {
"Dev-Forget-Channel.forced": 1,
"Dev-Forget-Channel.funding_txid": 3,
"Dev-Forget-Channel.funding_unspent": 2
},
"DisableofferRequest": {
"DisableOffer.offer_id": 1
},
Expand Down Expand Up @@ -4400,6 +4411,38 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"Dev-Forget-Channel": {
"added": "pre-v0.10.1",
"deprecated": null
},
"Dev-Forget-Channel.channel_id": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Dev-Forget-Channel.force": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Dev-Forget-Channel.forced": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Dev-Forget-Channel.funding_txid": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Dev-Forget-Channel.funding_unspent": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Dev-Forget-Channel.id": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Dev-Forget-Channel.short_channel_id": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DisableOffer": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
14 changes: 14 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.

35 changes: 35 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 @@ -658,6 +658,38 @@ impl Node for Server

}

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

}

async fn invoice(
&self,
request: tonic::Request<pb::InvoiceRequest>,
Expand Down
50 changes: 50 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.

1 change: 1 addition & 0 deletions contrib/msggen/msggen/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def load_jsonrpc_service():
"CreateOnion",
"DelDatastore",
"DelInvoice",
"Dev-Forget-Channel",
"Invoice",
"ListDatastore",
"ListInvoices",
Expand Down
1,158 changes: 581 additions & 577 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ def __init__(self, channel):
request_serializer=node__pb2.DelinvoiceRequest.SerializeToString,
response_deserializer=node__pb2.DelinvoiceResponse.FromString,
)
self.DevForgetChannel = channel.unary_unary(
'/cln.Node/DevForgetChannel',
request_serializer=node__pb2.DevforgetchannelRequest.SerializeToString,
response_deserializer=node__pb2.DevforgetchannelResponse.FromString,
)
self.Invoice = channel.unary_unary(
'/cln.Node/Invoice',
request_serializer=node__pb2.InvoiceRequest.SerializeToString,
Expand Down Expand Up @@ -632,6 +637,12 @@ def DelInvoice(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def DevForgetChannel(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 Invoice(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand Down Expand Up @@ -1223,6 +1234,11 @@ def add_NodeServicer_to_server(servicer, server):
request_deserializer=node__pb2.DelinvoiceRequest.FromString,
response_serializer=node__pb2.DelinvoiceResponse.SerializeToString,
),
'DevForgetChannel': grpc.unary_unary_rpc_method_handler(
servicer.DevForgetChannel,
request_deserializer=node__pb2.DevforgetchannelRequest.FromString,
response_serializer=node__pb2.DevforgetchannelResponse.SerializeToString,
),
'Invoice': grpc.unary_unary_rpc_method_handler(
servicer.Invoice,
request_deserializer=node__pb2.InvoiceRequest.FromString,
Expand Down Expand Up @@ -1954,6 +1970,23 @@ def DelInvoice(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def DevForgetChannel(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/DevForgetChannel',
node__pb2.DevforgetchannelRequest.SerializeToString,
node__pb2.DevforgetchannelResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def Invoice(request,
target,
Expand Down
8 changes: 8 additions & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,14 @@ def delinvoice2py(m):
})


def dev_forget_channel2py(m):
return remove_default({
"forced": m.forced, # PrimitiveField in generate_composite
"funding_txid": hexlify(m.funding_txid), # PrimitiveField in generate_composite
"funding_unspent": m.funding_unspent, # PrimitiveField in generate_composite
})


def invoice2py(m):
return remove_default({
"bolt11": m.bolt11, # PrimitiveField in generate_composite
Expand Down

0 comments on commit b8a6512

Please sign in to comment.