mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
Setchannel request is provided
This commit is contained in:
parent
6324980484
commit
51e2433087
21
.msggen.json
21
.msggen.json
@ -973,6 +973,27 @@
|
||||
"SendPsbt.tx": 1,
|
||||
"SendPsbt.txid": 2
|
||||
},
|
||||
"SetchannelChannels": {
|
||||
"SetChannel.channels[].channel_id": 2,
|
||||
"SetChannel.channels[].fee_base_msat": 4,
|
||||
"SetChannel.channels[].fee_proportional_millionths": 5,
|
||||
"SetChannel.channels[].maximum_htlc_out_msat": 8,
|
||||
"SetChannel.channels[].minimum_htlc_out_msat": 6,
|
||||
"SetChannel.channels[].peer_id": 1,
|
||||
"SetChannel.channels[].short_channel_id": 3,
|
||||
"SetChannel.channels[].warning_htlcmax_too_high": 9,
|
||||
"SetChannel.channels[].warning_htlcmin_too_low": 7
|
||||
},
|
||||
"SetchannelRequest": {
|
||||
"SetChannel.feebase": 2,
|
||||
"SetChannel.feeppm": 3,
|
||||
"SetChannel.htlcmax": 5,
|
||||
"SetChannel.htlcmin": 4,
|
||||
"SetChannel.id": 1
|
||||
},
|
||||
"SetchannelResponse": {
|
||||
"SetChannel.channels[]": 1
|
||||
},
|
||||
"SignmessageRequest": {
|
||||
"SignMessage.message": 1
|
||||
},
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1434,6 +1434,38 @@ async fn ping(
|
||||
|
||||
}
|
||||
|
||||
async fn set_channel(
|
||||
&self,
|
||||
request: tonic::Request<pb::SetchannelRequest>,
|
||||
) -> Result<tonic::Response<pb::SetchannelResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::SetchannelRequest = (&req).into();
|
||||
debug!("Client asked for set_channel");
|
||||
trace!("set_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::SetChannel(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method SetChannel: {:?}", e)))?;
|
||||
match result {
|
||||
Response::SetChannel(r) => {
|
||||
trace!("set_channel response: {:?}", r);
|
||||
Ok(tonic::Response::new((&r).into()))
|
||||
},
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call SetChannel",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn sign_message(
|
||||
&self,
|
||||
request: tonic::Request<pb::SignmessageRequest>,
|
||||
|
Binary file not shown.
@ -107,6 +107,7 @@ def load_jsonrpc_service(schema_dir: str = None):
|
||||
# "sendinvoice",
|
||||
# "sendonionmessage",
|
||||
# "setchannelfee",
|
||||
"SetChannel",
|
||||
"SignMessage",
|
||||
# "unreserveinputs",
|
||||
# "waitblockheight",
|
||||
|
@ -849,6 +849,26 @@ def ping2py(m):
|
||||
})
|
||||
|
||||
|
||||
def setchannel_channels2py(m):
|
||||
return remove_default({
|
||||
"peer_id": hexlify(m.peer_id), # PrimitiveField in generate_composite
|
||||
"channel_id": hexlify(m.channel_id), # PrimitiveField in generate_composite
|
||||
"short_channel_id": m.short_channel_id, # PrimitiveField in generate_composite
|
||||
"fee_base_msat": amount2msat(m.fee_base_msat), # PrimitiveField in generate_composite
|
||||
"fee_proportional_millionths": m.fee_proportional_millionths, # PrimitiveField in generate_composite
|
||||
"minimum_htlc_out_msat": amount2msat(m.minimum_htlc_out_msat), # PrimitiveField in generate_composite
|
||||
"warning_htlcmin_too_low": m.warning_htlcmin_too_low, # PrimitiveField in generate_composite
|
||||
"maximum_htlc_out_msat": amount2msat(m.maximum_htlc_out_msat), # PrimitiveField in generate_composite
|
||||
"warning_htlcmax_too_high": m.warning_htlcmax_too_high, # PrimitiveField in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def setchannel2py(m):
|
||||
return remove_default({
|
||||
"channels": [setchannel_channels2py(i) for i in m.channels], # ArrayField[composite] in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def signmessage2py(m):
|
||||
return remove_default({
|
||||
"signature": hexlify(m.signature), # PrimitiveField in generate_composite
|
||||
|
Binary file not shown.
@ -234,6 +234,11 @@ class NodeStub(object):
|
||||
request_serializer=node__pb2.PingRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.PingResponse.FromString,
|
||||
)
|
||||
self.SetChannel = channel.unary_unary(
|
||||
'/cln.Node/SetChannel',
|
||||
request_serializer=node__pb2.SetchannelRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.SetchannelResponse.FromString,
|
||||
)
|
||||
self.SignMessage = channel.unary_unary(
|
||||
'/cln.Node/SignMessage',
|
||||
request_serializer=node__pb2.SignmessageRequest.SerializeToString,
|
||||
@ -513,6 +518,12 @@ class NodeServicer(object):
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetChannel(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 SignMessage(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
@ -748,6 +759,11 @@ def add_NodeServicer_to_server(servicer, server):
|
||||
request_deserializer=node__pb2.PingRequest.FromString,
|
||||
response_serializer=node__pb2.PingResponse.SerializeToString,
|
||||
),
|
||||
'SetChannel': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetChannel,
|
||||
request_deserializer=node__pb2.SetchannelRequest.FromString,
|
||||
response_serializer=node__pb2.SetchannelResponse.SerializeToString,
|
||||
),
|
||||
'SignMessage': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SignMessage,
|
||||
request_deserializer=node__pb2.SignmessageRequest.FromString,
|
||||
@ -1516,6 +1532,23 @@ class Node(object):
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def SetChannel(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/SetChannel',
|
||||
node__pb2.SetchannelRequest.SerializeToString,
|
||||
node__pb2.SetchannelResponse.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def SignMessage(request,
|
||||
target,
|
||||
|
25
doc/schemas/setchannel.request.json
Normal file
25
doc/schemas/setchannel.request.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"feebase": {
|
||||
"type": "msat"
|
||||
},
|
||||
"feeppm": {
|
||||
"type": "u32"
|
||||
},
|
||||
"htlcmin": {
|
||||
"type": "msat"
|
||||
},
|
||||
"htlcmax": {
|
||||
"type": "msat"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user