Skip to content

Commit

Permalink
msggen: add splice_update method
Browse files Browse the repository at this point in the history
  • Loading branch information
daywalker90 committed Apr 24, 2024
1 parent aa90d0e commit d67b81e
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 51 deletions.
24 changes: 24 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -2105,6 +2105,14 @@
"Splice_Signed.tx": 1,
"Splice_Signed.txid": 2
},
"Splice_updateRequest": {
"Splice_Update.channel_id": 1,
"Splice_Update.psbt": 2
},
"Splice_updateResponse": {
"Splice_Update.commitments_secured": 2,
"Splice_Update.psbt": 1
},
"StaticbackupResponse": {
"StaticBackup.scb[]": 1
},
Expand Down Expand Up @@ -7371,6 +7379,22 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"Splice_Update": {
"added": "pre-v0.10.1",
"deprecated": null
},
"Splice_Update.channel_id": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Splice_Update.commitments_secured": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Splice_Update.psbt": {
"added": "pre-v0.10.1",
"deprecated": false
},
"StaticBackup": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
11 changes: 11 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.

30 changes: 30 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 @@ -2330,6 +2330,38 @@ async fn splice_signed(

}

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

}

async fn unreserve_inputs(
&self,
request: tonic::Request<pb::UnreserveinputsRequest>,
Expand Down
42 changes: 42 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 @@ -138,6 +138,7 @@ def load_jsonrpc_service():
"SignMessage",
"Splice_Init",
"Splice_Signed",
"Splice_Update",
"UnreserveInputs",
"WaitBlockHeight",
"Wait",
Expand Down
106 changes: 55 additions & 51 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 @@ -374,6 +374,11 @@ def __init__(self, channel):
request_serializer=node__pb2.Splice_signedRequest.SerializeToString,
response_deserializer=node__pb2.Splice_signedResponse.FromString,
)
self.Splice_Update = channel.unary_unary(
'/cln.Node/Splice_Update',
request_serializer=node__pb2.Splice_updateRequest.SerializeToString,
response_deserializer=node__pb2.Splice_updateResponse.FromString,
)
self.UnreserveInputs = channel.unary_unary(
'/cln.Node/UnreserveInputs',
request_serializer=node__pb2.UnreserveinputsRequest.SerializeToString,
Expand Down Expand Up @@ -851,6 +856,12 @@ def Splice_Signed(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def Splice_Update(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 UnreserveInputs(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand Down Expand Up @@ -1262,6 +1273,11 @@ def add_NodeServicer_to_server(servicer, server):
request_deserializer=node__pb2.Splice_signedRequest.FromString,
response_serializer=node__pb2.Splice_signedResponse.SerializeToString,
),
'Splice_Update': grpc.unary_unary_rpc_method_handler(
servicer.Splice_Update,
request_deserializer=node__pb2.Splice_updateRequest.FromString,
response_serializer=node__pb2.Splice_updateResponse.SerializeToString,
),
'UnreserveInputs': grpc.unary_unary_rpc_method_handler(
servicer.UnreserveInputs,
request_deserializer=node__pb2.UnreserveinputsRequest.FromString,
Expand Down Expand Up @@ -2536,6 +2552,23 @@ def Splice_Signed(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

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

@staticmethod
def UnreserveInputs(request,
target,
Expand Down
7 changes: 7 additions & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,13 @@ def splice_signed2py(m):
})


def splice_update2py(m):
return remove_default({
"commitments_secured": m.commitments_secured, # PrimitiveField in generate_composite
"psbt": m.psbt, # PrimitiveField in generate_composite
})


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

0 comments on commit d67b81e

Please sign in to comment.