mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
lightningd: remove expermential "sendonionmessage" function.
It was only ever expermental, so I don't feel bad about just removing it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Removed: JSON-RPC: `sendonionmessage` (was experimental only, use `injectonionmessage`)
This commit is contained in:
parent
91cd68920c
commit
3c04b6f8d3
BIN
cln-grpc/proto/node.proto
generated
BIN
cln-grpc/proto/node.proto
generated
Binary file not shown.
BIN
cln-grpc/src/convert.rs
generated
BIN
cln-grpc/src/convert.rs
generated
Binary file not shown.
@ -2738,38 +2738,6 @@ impl Node for Server
|
||||
|
||||
}
|
||||
|
||||
async fn send_onion_message(
|
||||
&self,
|
||||
request: tonic::Request<pb::SendonionmessageRequest>,
|
||||
) -> Result<tonic::Response<pb::SendonionmessageResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::SendonionmessageRequest = req.into();
|
||||
debug!("Client asked for send_onion_message");
|
||||
trace!("send_onion_message 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::SendOnionMessage(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method SendOnionMessage: {:?}", e)))?;
|
||||
match result {
|
||||
Response::SendOnionMessage(r) => {
|
||||
trace!("send_onion_message response: {:?}", r);
|
||||
Ok(tonic::Response::new(r.into()))
|
||||
},
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call SendOnionMessage",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn set_channel(
|
||||
&self,
|
||||
request: tonic::Request<pb::SetchannelRequest>,
|
||||
|
BIN
cln-rpc/src/model.rs
generated
BIN
cln-rpc/src/model.rs
generated
Binary file not shown.
@ -26341,83 +26341,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"lightning-sendonionmessage.json": {
|
||||
"$schema": "../rpc-schema-draft.json",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"rpc": "sendonionmessage",
|
||||
"title": "low-level command to send an onion message",
|
||||
"warning": "experimental-onion-messages only",
|
||||
"description": [
|
||||
"The **sendonionmessage** RPC command can be used to send a message via the lightning network. These are currently used by *offers* to request and receive invoices."
|
||||
],
|
||||
"request": {
|
||||
"required": [
|
||||
"first_id",
|
||||
"blinding",
|
||||
"hops"
|
||||
],
|
||||
"properties": {
|
||||
"first_id": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
"The (presumably well-known) public key of the start of the path."
|
||||
]
|
||||
},
|
||||
"blinding": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
"Blinding factor for this path."
|
||||
]
|
||||
},
|
||||
"hops": {
|
||||
"type": "array",
|
||||
"description": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"node",
|
||||
"tlv"
|
||||
],
|
||||
"properties": {
|
||||
"node": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
"Public key of the node."
|
||||
]
|
||||
},
|
||||
"tlv": {
|
||||
"type": "u8",
|
||||
"description": [
|
||||
"Contains a hexadecimal TLV to include."
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"required": [],
|
||||
"properties": {}
|
||||
},
|
||||
"author": [
|
||||
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
|
||||
],
|
||||
"see_also": [
|
||||
"lightning-fetchinvoice(7)",
|
||||
"lightning-offer(7)"
|
||||
],
|
||||
"resources": [
|
||||
"Main web site: <https://github.com/ElementsProject/lightning>",
|
||||
"",
|
||||
"[bolt04]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md"
|
||||
]
|
||||
},
|
||||
"lightning-sendpay.json": {
|
||||
"$schema": "../rpc-schema-draft.json",
|
||||
"type": "object",
|
||||
|
@ -90,7 +90,6 @@ grpc_method_names = [
|
||||
"ReserveInputs",
|
||||
"SendCustomMsg",
|
||||
"SendInvoice",
|
||||
"SendOnionMessage",
|
||||
"SetChannel",
|
||||
"SetConfig",
|
||||
"SetPsbtVersion",
|
||||
|
File diff suppressed because one or more lines are too long
@ -429,11 +429,6 @@ class NodeStub(object):
|
||||
request_serializer=node__pb2.SendinvoiceRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.SendinvoiceResponse.FromString,
|
||||
)
|
||||
self.SendOnionMessage = channel.unary_unary(
|
||||
'/cln.Node/SendOnionMessage',
|
||||
request_serializer=node__pb2.SendonionmessageRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.SendonionmessageResponse.FromString,
|
||||
)
|
||||
self.SetChannel = channel.unary_unary(
|
||||
'/cln.Node/SetChannel',
|
||||
request_serializer=node__pb2.SetchannelRequest.SerializeToString,
|
||||
@ -1102,12 +1097,6 @@ class NodeServicer(object):
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SendOnionMessage(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 SetChannel(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
@ -1724,11 +1713,6 @@ def add_NodeServicer_to_server(servicer, server):
|
||||
request_deserializer=node__pb2.SendinvoiceRequest.FromString,
|
||||
response_serializer=node__pb2.SendinvoiceResponse.SerializeToString,
|
||||
),
|
||||
'SendOnionMessage': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SendOnionMessage,
|
||||
request_deserializer=node__pb2.SendonionmessageRequest.FromString,
|
||||
response_serializer=node__pb2.SendonionmessageResponse.SerializeToString,
|
||||
),
|
||||
'SetChannel': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetChannel,
|
||||
request_deserializer=node__pb2.SetchannelRequest.FromString,
|
||||
@ -3315,23 +3299,6 @@ class Node(object):
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def SendOnionMessage(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/SendOnionMessage',
|
||||
node__pb2.SendonionmessageRequest.SerializeToString,
|
||||
node__pb2.SendonionmessageResponse.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def SetChannel(request,
|
||||
target,
|
||||
|
@ -1874,11 +1874,6 @@ def sendinvoice2py(m):
|
||||
})
|
||||
|
||||
|
||||
def sendonionmessage2py(m):
|
||||
return remove_default({
|
||||
})
|
||||
|
||||
|
||||
def setchannel_channels2py(m):
|
||||
return remove_default({
|
||||
"channel_id": hexlify(m.channel_id), # PrimitiveField in generate_composite
|
||||
|
@ -98,7 +98,6 @@ GENERATE_MARKDOWN := doc/lightning-addgossip.7 \
|
||||
doc/lightning-sendcustommsg.7 \
|
||||
doc/lightning-sendinvoice.7 \
|
||||
doc/lightning-sendonion.7 \
|
||||
doc/lightning-sendonionmessage.7 \
|
||||
doc/lightning-sendpay.7 \
|
||||
doc/lightning-sendpsbt.7 \
|
||||
doc/lightning-setchannel.7 \
|
||||
|
@ -109,7 +109,6 @@ Core Lightning Documentation
|
||||
lightning-sendcustommsg <lightning-sendcustommsg.7.md>
|
||||
lightning-sendinvoice <lightning-sendinvoice.7.md>
|
||||
lightning-sendonion <lightning-sendonion.7.md>
|
||||
lightning-sendonionmessage <lightning-sendonionmessage.7.md>
|
||||
lightning-sendpay <lightning-sendpay.7.md>
|
||||
lightning-sendpsbt <lightning-sendpsbt.7.md>
|
||||
lightning-setchannel <lightning-setchannel.7.md>
|
||||
|
@ -1,77 +0,0 @@
|
||||
{
|
||||
"$schema": "../rpc-schema-draft.json",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"rpc": "sendonionmessage",
|
||||
"title": "low-level command to send an onion message",
|
||||
"warning": "experimental-onion-messages only",
|
||||
"description": [
|
||||
"The **sendonionmessage** RPC command can be used to send a message via the lightning network. These are currently used by *offers* to request and receive invoices."
|
||||
],
|
||||
"request": {
|
||||
"required": [
|
||||
"first_id",
|
||||
"blinding",
|
||||
"hops"
|
||||
],
|
||||
"properties": {
|
||||
"first_id": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
"The (presumably well-known) public key of the start of the path."
|
||||
]
|
||||
},
|
||||
"blinding": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
"Blinding factor for this path."
|
||||
]
|
||||
},
|
||||
"hops": {
|
||||
"type": "array",
|
||||
"description": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"node",
|
||||
"tlv"
|
||||
],
|
||||
"properties": {
|
||||
"node": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
"Public key of the node."
|
||||
]
|
||||
},
|
||||
"tlv": {
|
||||
"type": "u8",
|
||||
"description": [
|
||||
"Contains a hexadecimal TLV to include."
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"required": [],
|
||||
"properties": {}
|
||||
},
|
||||
"author": [
|
||||
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
|
||||
],
|
||||
"see_also": [
|
||||
"lightning-fetchinvoice(7)",
|
||||
"lightning-offer(7)"
|
||||
],
|
||||
"resources": [
|
||||
"Main web site: <https://github.com/ElementsProject/lightning>",
|
||||
"",
|
||||
"[bolt04]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md"
|
||||
]
|
||||
}
|
@ -184,74 +184,6 @@ static struct command_result *param_onion_hops(struct command *cmd,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct command_result *json_sendonionmessage(struct command *cmd,
|
||||
const char *buffer,
|
||||
const jsmntok_t *obj UNNEEDED,
|
||||
const jsmntok_t *params)
|
||||
{
|
||||
struct onion_hop *hops;
|
||||
struct node_id *first_id;
|
||||
struct pubkey *blinding;
|
||||
struct sphinx_path *sphinx_path;
|
||||
struct onionpacket *op;
|
||||
struct secret *path_secrets;
|
||||
size_t onion_size;
|
||||
|
||||
/* FIXME: Support using scid for first hop! */
|
||||
if (!param_check(cmd, buffer, params,
|
||||
p_req("first_id", param_node_id, &first_id),
|
||||
p_req("blinding", param_pubkey, &blinding),
|
||||
p_req("hops", param_onion_hops, &hops),
|
||||
NULL))
|
||||
return command_param_failed();
|
||||
|
||||
if (!feature_offered(cmd->ld->our_features->bits[NODE_ANNOUNCE_FEATURE],
|
||||
OPT_ONION_MESSAGES))
|
||||
return command_fail(cmd, LIGHTNINGD,
|
||||
"experimental-onion-messages not enabled");
|
||||
|
||||
/* Sanity check first; connectd doesn't bother telling us if peer
|
||||
* can't be reached. */
|
||||
if (!peer_by_id(cmd->ld, first_id))
|
||||
return command_fail(cmd, LIGHTNINGD, "Unknown first peer");
|
||||
|
||||
/* Create an onion which encodes this. */
|
||||
sphinx_path = sphinx_path_new(cmd, NULL);
|
||||
for (size_t i = 0; i < tal_count(hops); i++)
|
||||
sphinx_add_hop(sphinx_path, &hops[i].node, hops[i].tlv);
|
||||
|
||||
/* BOLT-onion-message #4:
|
||||
* - SHOULD set `onion_message_packet` `len` to 1366 or 32834.
|
||||
*/
|
||||
if (sphinx_path_payloads_size(sphinx_path) <= ROUTING_INFO_SIZE)
|
||||
onion_size = ROUTING_INFO_SIZE;
|
||||
else
|
||||
onion_size = 32768;
|
||||
|
||||
op = create_onionpacket(tmpctx, sphinx_path, onion_size, &path_secrets);
|
||||
if (!op)
|
||||
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"Creating onion failed (tlvs too long?)");
|
||||
|
||||
if (command_check_only(cmd))
|
||||
return command_check_done(cmd);
|
||||
|
||||
subd_send_msg(cmd->ld->connectd,
|
||||
take(towire_connectd_send_onionmsg(NULL, first_id,
|
||||
serialize_onionpacket(tmpctx, op),
|
||||
blinding)));
|
||||
|
||||
return command_success(cmd, json_stream_success(cmd));
|
||||
}
|
||||
|
||||
static const struct json_command sendonionmessage_command = {
|
||||
"sendonionmessage",
|
||||
"utility",
|
||||
json_sendonionmessage,
|
||||
"Send message to {first_id}, using {blinding}, encoded over {hops} (id, tlv)"
|
||||
};
|
||||
AUTODATA(json_command, &sendonionmessage_command);
|
||||
|
||||
static void inject_onionmsg_reply(struct subd *connectd,
|
||||
const u8 *reply,
|
||||
const int *fds UNUSED,
|
||||
|
@ -139,7 +139,6 @@ nav:
|
||||
- "lightning-sendcustommsg": "lightning-sendcustommsg.7.md"
|
||||
- "lightning-sendinvoice": "lightning-sendinvoice.7.md"
|
||||
- "lightning-sendonion": "lightning-sendonion.7.md"
|
||||
- "lightning-sendonionmessage": "lightning-sendonionmessage.7.md"
|
||||
- "lightning-sendpay": "lightning-sendpay.7.md"
|
||||
- "lightning-sendpsbt": "lightning-sendpsbt.7.md"
|
||||
- "lightning-setchannel": "lightning-setchannel.7.md"
|
||||
|
Loading…
Reference in New Issue
Block a user