Skip to content

Commit 3e46103

Browse files
daywalker90endothermicdev
authored andcommitted
msggen: add InjectOnionMessage
Changelog-None
1 parent 5dab24f commit 3e46103

File tree

9 files changed

+207
-39
lines changed

9 files changed

+207
-39
lines changed

.msggen.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,6 +1834,10 @@
18341834
"Help.format-hint": 2,
18351835
"Help.help[]": 1
18361836
},
1837+
"InjectonionmessageRequest": {
1838+
"InjectOnionMessage.message": 2,
1839+
"InjectOnionMessage.path_key": 1
1840+
},
18371841
"InjectpaymentonionRequest": {
18381842
"InjectPaymentOnion.amount_msat": 3,
18391843
"InjectPaymentOnion.cltv_expiry": 4,
@@ -7589,6 +7593,18 @@
75897593
"added": "pre-v0.10.1",
75907594
"deprecated": null
75917595
},
7596+
"InjectOnionMessage": {
7597+
"added": "v24.11",
7598+
"deprecated": null
7599+
},
7600+
"InjectOnionMessage.message": {
7601+
"added": "v24.11",
7602+
"deprecated": null
7603+
},
7604+
"InjectOnionMessage.path_key": {
7605+
"added": "v24.11",
7606+
"deprecated": null
7607+
},
75927608
"InjectPaymentOnion": {
75937609
"added": "v24.11",
75947610
"deprecated": null

cln-grpc/proto/node.proto

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-grpc/src/convert.rs

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-grpc/src/server.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4306,6 +4306,38 @@ impl Node for Server
43064306

43074307
}
43084308

4309+
async fn inject_onion_message(
4310+
&self,
4311+
request: tonic::Request<pb::InjectonionmessageRequest>,
4312+
) -> Result<tonic::Response<pb::InjectonionmessageResponse>, tonic::Status> {
4313+
let req = request.into_inner();
4314+
let req: requests::InjectonionmessageRequest = req.into();
4315+
debug!("Client asked for inject_onion_message");
4316+
trace!("inject_onion_message request: {:?}", req);
4317+
let mut rpc = ClnRpc::new(&self.rpc_path)
4318+
.await
4319+
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
4320+
let result = rpc.call(Request::InjectOnionMessage(req))
4321+
.await
4322+
.map_err(|e| Status::new(
4323+
Code::Unknown,
4324+
format!("Error calling method InjectOnionMessage: {:?}", e)))?;
4325+
match result {
4326+
Response::InjectOnionMessage(r) => {
4327+
trace!("inject_onion_message response: {:?}", r);
4328+
Ok(tonic::Response::new(r.into()))
4329+
},
4330+
r => Err(Status::new(
4331+
Code::Internal,
4332+
format!(
4333+
"Unexpected result {:?} to method call InjectOnionMessage",
4334+
r
4335+
)
4336+
)),
4337+
}
4338+
4339+
}
4340+
43094341
async fn xpay(
43104342
&self,
43114343
request: tonic::Request<pb::XpayRequest>,

cln-rpc/src/model.rs

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/msggen/msggen/utils/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"AskRene-Bias-Channel",
142142
"AskRene-ListReservations",
143143
"InjectPaymentOnion",
144+
"InjectOnionMessage",
144145
"Xpay",
145146
]
146147

contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Lines changed: 43 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/pyln-grpc-proto/pyln/grpc/node_pb2_grpc.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,11 @@ def __init__(self, channel):
674674
request_serializer=node__pb2.InjectpaymentonionRequest.SerializeToString,
675675
response_deserializer=node__pb2.InjectpaymentonionResponse.FromString,
676676
)
677+
self.InjectOnionMessage = channel.unary_unary(
678+
'/cln.Node/InjectOnionMessage',
679+
request_serializer=node__pb2.InjectonionmessageRequest.SerializeToString,
680+
response_deserializer=node__pb2.InjectonionmessageResponse.FromString,
681+
)
677682
self.Xpay = channel.unary_unary(
678683
'/cln.Node/Xpay',
679684
request_serializer=node__pb2.XpayRequest.SerializeToString,
@@ -1506,6 +1511,12 @@ def InjectPaymentOnion(self, request, context):
15061511
context.set_details('Method not implemented!')
15071512
raise NotImplementedError('Method not implemented!')
15081513

1514+
def InjectOnionMessage(self, request, context):
1515+
"""Missing associated documentation comment in .proto file."""
1516+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
1517+
context.set_details('Method not implemented!')
1518+
raise NotImplementedError('Method not implemented!')
1519+
15091520
def Xpay(self, request, context):
15101521
"""Missing associated documentation comment in .proto file."""
15111522
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@@ -2211,6 +2222,11 @@ def add_NodeServicer_to_server(servicer, server):
22112222
request_deserializer=node__pb2.InjectpaymentonionRequest.FromString,
22122223
response_serializer=node__pb2.InjectpaymentonionResponse.SerializeToString,
22132224
),
2225+
'InjectOnionMessage': grpc.unary_unary_rpc_method_handler(
2226+
servicer.InjectOnionMessage,
2227+
request_deserializer=node__pb2.InjectonionmessageRequest.FromString,
2228+
response_serializer=node__pb2.InjectonionmessageResponse.SerializeToString,
2229+
),
22142230
'Xpay': grpc.unary_unary_rpc_method_handler(
22152231
servicer.Xpay,
22162232
request_deserializer=node__pb2.XpayRequest.FromString,
@@ -4500,6 +4516,23 @@ def InjectPaymentOnion(request,
45004516
options, channel_credentials,
45014517
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
45024518

4519+
@staticmethod
4520+
def InjectOnionMessage(request,
4521+
target,
4522+
options=(),
4523+
channel_credentials=None,
4524+
call_credentials=None,
4525+
insecure=False,
4526+
compression=None,
4527+
wait_for_ready=None,
4528+
timeout=None,
4529+
metadata=None):
4530+
return grpc.experimental.unary_unary(request, target, '/cln.Node/InjectOnionMessage',
4531+
node__pb2.InjectonionmessageRequest.SerializeToString,
4532+
node__pb2.InjectonionmessageResponse.FromString,
4533+
options, channel_credentials,
4534+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
4535+
45034536
@staticmethod
45044537
def Xpay(request,
45054538
target,

contrib/pyln-testing/pyln/testing/grpc2py.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3233,6 +3233,11 @@ def injectpaymentonion2py(m):
32333233
})
32343234

32353235

3236+
def injectonionmessage2py(m):
3237+
return remove_default({
3238+
})
3239+
3240+
32363241
def xpay2py(m):
32373242
return remove_default({
32383243
"amount_msat": amount2msat(m.amount_msat), # PrimitiveField in generate_composite

0 commit comments

Comments
 (0)