Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msggen: add batching method #7255

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,9 @@
"AutoCleanInvoice.enabled": 1,
"AutoCleanInvoice.expired_by": 2
},
"BatchingRequest": {
"Batching.enable": 1
},
"Bkpr-listincomeIncome_events": {
"Bkpr-ListIncome.income_events[].account": 1,
"Bkpr-ListIncome.income_events[].credit_msat": 3,
Expand Down Expand Up @@ -2424,6 +2427,14 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"Batching": {
"added": "pre-v0.10.1",
"deprecated": null
},
"Batching.enable": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Bkpr-ListIncome": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
8 changes: 8 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.

26 changes: 26 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,4 +2330,36 @@ async fn bkpr_list_income(

}

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

}

}
39 changes: 39 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 @@ -147,6 +147,7 @@ def load_jsonrpc_service():
"PreApproveInvoice",
"StaticBackup",
"Bkpr-ListIncome",
"Batching",
]
methods = [load_jsonrpc_method(name) for name in method_names]
service = Service(name="Node", methods=methods)
Expand Down
10 changes: 7 additions & 3 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.BkprlistincomeRequest.SerializeToString,
response_deserializer=node__pb2.BkprlistincomeResponse.FromString,
)
self.Batching = channel.unary_unary(
'/cln.Node/Batching',
request_serializer=node__pb2.BatchingRequest.SerializeToString,
response_deserializer=node__pb2.BatchingResponse.FromString,
)


class NodeServicer(object):
Expand Down Expand Up @@ -811,6 +816,12 @@ def BkprListIncome(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def Batching(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 add_NodeServicer_to_server(servicer, server):
rpc_method_handlers = {
Expand Down Expand Up @@ -1174,6 +1185,11 @@ def add_NodeServicer_to_server(servicer, server):
request_deserializer=node__pb2.BkprlistincomeRequest.FromString,
response_serializer=node__pb2.BkprlistincomeResponse.SerializeToString,
),
'Batching': grpc.unary_unary_rpc_method_handler(
servicer.Batching,
request_deserializer=node__pb2.BatchingRequest.FromString,
response_serializer=node__pb2.BatchingResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'cln.Node', rpc_method_handlers)
Expand Down Expand Up @@ -2407,3 +2423,20 @@ def BkprListIncome(request,
node__pb2.BkprlistincomeResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def Batching(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/Batching',
node__pb2.BatchingRequest.SerializeToString,
node__pb2.BatchingResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
5 changes: 5 additions & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -1742,3 +1742,8 @@ def bkpr_listincome2py(m):
return remove_default({
"income_events": [bkpr_listincome_income_events2py(i) for i in m.income_events], # ArrayField[composite] in generate_composite
})


def batching2py(m):
return remove_default({
})
Loading