channeld: rename onion_message to obs_onion_message.

This splits the existing old-spec pathways to prepare for the
new ones.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-09-21 14:53:38 +09:30
parent f31f7b1eec
commit e3ae7883bb
19 changed files with 196 additions and 196 deletions

View File

@ -2270,7 +2270,7 @@ static void peer_in(struct peer *peer, const u8 *msg)
case WIRE_PONG:
case WIRE_WARNING:
case WIRE_ERROR:
case WIRE_ONION_MESSAGE:
case WIRE_OBS_ONION_MESSAGE:
abort();
}

View File

@ -146,7 +146,7 @@ int main(int argc, char **argv)
inner = tlv_encmsg_tlvs_new(tmpctx);
/* Use scid if they provided one */
if (scids[i]) {
inner->next_short_channel_id
inner->obs_next_short_channel_id
= tal_dup(inner, struct short_channel_id,
scids[i]);
} else {

View File

@ -381,7 +381,7 @@ static bool handle_local_channel_announcement(struct daemon *daemon,
}
/* Peer sends onion msg. */
static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
static u8 *handle_obs_onion_message(struct peer *peer, const u8 *msg)
{
enum onion_wire badreason;
struct onionpacket *op;
@ -392,7 +392,7 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
const u8 *cursor;
size_t max, maxlen;
struct tlv_onionmsg_payload *om;
struct tlv_onion_message_tlvs *tlvs = tlv_onion_message_tlvs_new(msg);
struct tlv_obs_onion_message_tlvs *tlvs = tlv_obs_onion_message_tlvs_new(msg);
/* Ignore unless explicitly turned on. */
if (!feature_offered(peer->daemon->our_features->bits[NODE_ANNOUNCE_FEATURE],
@ -400,7 +400,7 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
return NULL;
/* FIXME: ratelimit! */
if (!fromwire_onion_message(msg, msg, &onion, tlvs))
if (!fromwire_obs_onion_message(msg, msg, &onion, tlvs))
return towire_warningfmt(peer, NULL, "Bad onion_message");
/* We unwrap the onion now. */
@ -480,9 +480,9 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
}
/* If we weren't given a blinding factor, tlv can provide one. */
if (om->blinding && !blinding_ss) {
if (om->obs_blinding && !blinding_ss) {
/* E(i) */
blinding_in = tal_dup(msg, struct pubkey, om->blinding);
blinding_in = tal_dup(msg, struct pubkey, om->obs_blinding);
blinding_ss = tal(msg, struct secret);
ecdh(blinding_in, blinding_ss);
@ -554,10 +554,10 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
const struct onionmsg_path **path;
u8 *omsg;
if (om->reply_path) {
blinding = &om->reply_path->blinding;
if (om->obs_reply_path) {
blinding = &om->obs_reply_path->blinding;
path = cast_const2(const struct onionmsg_path **,
om->reply_path->path);
om->obs_reply_path->path);
} else {
blinding = NULL;
path = NULL;
@ -577,7 +577,7 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
struct node_id *next_node;
/* This *MUST* have instructions on where to go next. */
if (!om->next_short_channel_id && !om->next_node_id) {
if (!om->obs_next_short_channel_id && !om->obs_next_node_id) {
status_debug("peer %s: onion msg: no next field in %s",
type_to_string(tmpctx, struct node_id, &peer->id),
tal_hex(tmpctx, rs->raw_payload));
@ -593,15 +593,15 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
} else
next_blinding = NULL;
if (om->next_node_id) {
if (om->obs_next_node_id) {
next_node = tal(tmpctx, struct node_id);
node_id_from_pubkey(next_node, om->next_node_id);
node_id_from_pubkey(next_node, om->obs_next_node_id);
} else
next_node = NULL;
daemon_conn_send(peer->daemon->master,
take(towire_gossipd_got_onionmsg_forward(NULL,
om->next_short_channel_id,
om->obs_next_short_channel_id,
next_node,
next_blinding,
serialize_onionpacket(tmpctx, rs->next))));
@ -627,14 +627,14 @@ static struct io_plan *onionmsg_req(struct io_conn *conn, struct daemon *daemon,
* handle it here with 'sent' = false. */
peer = find_peer(daemon, &id);
if (peer) {
struct tlv_onion_message_tlvs *tlvs;
struct tlv_obs_onion_message_tlvs *tlvs;
tlvs = tlv_onion_message_tlvs_new(msg);
tlvs = tlv_obs_onion_message_tlvs_new(msg);
if (blinding)
tlvs->blinding = tal_dup(tlvs, struct pubkey, blinding);
queue_peer_msg(peer,
take(towire_onion_message(NULL,
take(towire_obs_onion_message(NULL,
onion_routing_packet,
tlvs)));
}
@ -680,8 +680,8 @@ static struct io_plan *peer_msg_in(struct io_conn *conn,
case WIRE_PONG:
err = handle_pong(peer, msg);
goto handled_relay;
case WIRE_ONION_MESSAGE:
err = handle_onion_message(peer, msg);
case WIRE_OBS_ONION_MESSAGE:
err = handle_obs_onion_message(peer, msg);
goto handled_relay;
/* These are non-gossip messages (!is_msg_for_gossipd()) */

View File

@ -291,12 +291,12 @@ static struct command_result *param_reply_path(struct command *cmd,
const char *name,
const char *buffer,
const jsmntok_t *tok,
struct tlv_onionmsg_payload_reply_path **reply_path)
struct tlv_onionmsg_payload_obs_reply_path **reply_path)
{
const jsmntok_t *tblinding, *tpath, *t;
size_t i;
*reply_path = tal(cmd, struct tlv_onionmsg_payload_reply_path);
*reply_path = tal(cmd, struct tlv_onionmsg_payload_obs_reply_path);
tblinding = json_get_member(buffer, tok, "blinding");
if (!tblinding)
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
@ -351,7 +351,7 @@ static struct command_result *param_reply_path(struct command *cmd,
/* Generate ->rawtlv if not already supplied. */
static void populate_tlvs(struct hop *hops,
struct tlv_onionmsg_payload_reply_path *reply_path)
struct tlv_onionmsg_payload_obs_reply_path *reply_path)
{
for (size_t i = 0; i < tal_count(hops); i++) {
struct tlv_onionmsg_payload *tlv;
@ -362,16 +362,16 @@ static void populate_tlvs(struct hop *hops,
tlv = tlv_onionmsg_payload_new(tmpctx);
/* If they don't give scid, use next node id */
if (hops[i].scid) {
tlv->next_short_channel_id
tlv->obs_next_short_channel_id
= tal_dup(tlv, struct short_channel_id,
hops[i].scid);
} else if (i != tal_count(hops)-1) {
tlv->next_node_id = tal_dup(tlv, struct pubkey,
&hops[i+1].id);
tlv->obs_next_node_id = tal_dup(tlv, struct pubkey,
&hops[i+1].id);
}
if (hops[i].blinding) {
tlv->blinding = tal_dup(tlv, struct pubkey,
hops[i].blinding);
tlv->obs_blinding = tal_dup(tlv, struct pubkey,
hops[i].blinding);
}
/* Note: tal_dup_talarr returns NULL for NULL */
tlv->enctlv = tal_dup_talarr(tlv, u8, hops[i].enctlv);
@ -382,7 +382,7 @@ static void populate_tlvs(struct hop *hops,
hops[i].invoice_err);
if (i == tal_count(hops)-1 && reply_path)
tlv->reply_path = reply_path;
tlv->obs_reply_path = reply_path;
hops[i].rawtlv = tal_arr(hops, u8, 0);
towire_onionmsg_payload(&hops[i].rawtlv, tlv);
@ -395,7 +395,7 @@ static struct command_result *json_send_onion_message(struct command *cmd,
const jsmntok_t *params)
{
struct hop *hops;
struct tlv_onionmsg_payload_reply_path *reply_path;
struct tlv_onionmsg_payload_obs_reply_path *reply_path;
struct sphinx_path *sphinx_path;
struct onionpacket *op;
struct secret *path_secrets;

View File

@ -1283,7 +1283,7 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state)
case WIRE_CHANNEL_REESTABLISH:
case WIRE_ANNOUNCEMENT_SIGNATURES:
case WIRE_GOSSIP_TIMESTAMP_FILTER:
case WIRE_ONION_MESSAGE:
case WIRE_OBS_ONION_MESSAGE:
case WIRE_ACCEPT_CHANNEL2:
case WIRE_TX_ADD_INPUT:
case WIRE_TX_REMOVE_INPUT:
@ -1631,7 +1631,7 @@ static bool run_tx_interactive(struct state *state,
case WIRE_CHANNEL_REESTABLISH:
case WIRE_ANNOUNCEMENT_SIGNATURES:
case WIRE_GOSSIP_TIMESTAMP_FILTER:
case WIRE_ONION_MESSAGE:
case WIRE_OBS_ONION_MESSAGE:
case WIRE_TX_SIGNATURES:
case WIRE_OPEN_CHANNEL2:
case WIRE_ACCEPT_CHANNEL2:
@ -3689,7 +3689,7 @@ static u8 *handle_peer_in(struct state *state)
case WIRE_CHANNEL_REESTABLISH:
case WIRE_ANNOUNCEMENT_SIGNATURES:
case WIRE_GOSSIP_TIMESTAMP_FILTER:
case WIRE_ONION_MESSAGE:
case WIRE_OBS_ONION_MESSAGE:
case WIRE_ACCEPT_CHANNEL2:
case WIRE_TX_ADD_INPUT:
case WIRE_TX_REMOVE_INPUT:

View File

@ -4,17 +4,17 @@
tlvtype,tlv_payload,payment_data,8
tlvdata,tlv_payload,payment_data,payment_secret,byte,32
tlvdata,tlv_payload,payment_data,total_msat,tu64,
+tlvtype,onionmsg_payload,next_node_id,4
+tlvdata,onionmsg_payload,next_node_id,node_id,point,
+tlvtype,onionmsg_payload,next_short_channel_id,6
+tlvdata,onionmsg_payload,next_short_channel_id,short_channel_id,short_channel_id,
+tlvtype,onionmsg_payload,reply_path,8
+tlvdata,onionmsg_payload,reply_path,blinding,point,
+tlvdata,onionmsg_payload,reply_path,path,onionmsg_path,...
+tlvtype,onionmsg_payload,obs_next_node_id,4
+tlvdata,onionmsg_payload,obs_next_node_id,node_id,point,
+tlvtype,onionmsg_payload,obs_next_short_channel_id,6
+tlvdata,onionmsg_payload,obs_next_short_channel_id,short_channel_id,short_channel_id,
+tlvtype,onionmsg_payload,obs_reply_path,8
+tlvdata,onionmsg_payload,obs_reply_path,blinding,point,
+tlvdata,onionmsg_payload,obs_reply_path,path,onionmsg_path,...
+tlvtype,onionmsg_payload,enctlv,10
+tlvdata,onionmsg_payload,enctlv,enctlv,byte,...
+tlvtype,onionmsg_payload,blinding,12
+tlvdata,onionmsg_payload,blinding,blinding,point,
+tlvtype,onionmsg_payload,obs_blinding,12
+tlvdata,onionmsg_payload,obs_blinding,blinding,point,
+tlvtype,onionmsg_payload,invoice_request,64
+tlvdata,onionmsg_payload,invoice_request,invoice_request,byte,...
+tlvtype,onionmsg_payload,invoice,66
@ -23,8 +23,8 @@
+tlvdata,onionmsg_payload,invoice_error,invoice_error,byte,...
+tlvtype,encmsg_tlvs,next_node_id,4
+tlvdata,encmsg_tlvs,next_node_id,node_id,point,
+tlvtype,encmsg_tlvs,next_short_channel_id,6
+tlvdata,encmsg_tlvs,next_short_channel_id,short_channel_id,short_channel_id,
+tlvtype,encmsg_tlvs,obs_next_short_channel_id,6
+tlvdata,encmsg_tlvs,obs_next_short_channel_id,short_channel_id,short_channel_id,
+subtype,onionmsg_path
+subtypedata,onionmsg_path,node_id,point,
+subtypedata,onionmsg_path,enclen,u16,

View File

@ -8,7 +8,7 @@
+tlvdata,tlv_payload,enctlv,enctlv,byte,...
+tlvtype,tlv_payload,blinding_seed,12
+tlvdata,tlv_payload,blinding_seed,blinding_seed,pubkey,
tlvtype,onionmsg_payload,next_node_id,4
tlvdata,onionmsg_payload,next_node_id,node_id,point,
tlvtype,onionmsg_payload,next_short_channel_id,6
tlvtype,onionmsg_payload,obs_next_node_id,4
tlvdata,onionmsg_payload,obs_next_node_id,node_id,point,
tlvtype,onionmsg_payload,obs_next_short_channel_id,6

View File

@ -4,9 +4,9 @@
msgdata,gossip_timestamp_filter,chain_hash,chain_hash,
msgdata,gossip_timestamp_filter,first_timestamp,u32,
msgdata,gossip_timestamp_filter,timestamp_range,u32,
+msgtype,onion_message,385,option_onion_messages
+msgdata,onion_message,len,u16,
+msgdata,onion_message,onionmsg,byte,len
+msgdata,onion_message,onion_message_tlvs,onion_message_tlvs,
+tlvtype,onion_message_tlvs,blinding,2
+tlvdata,onion_message_tlvs,blinding,blinding,point,
+msgtype,obs_onion_message,385,option_onion_messages
+msgdata,obs_onion_message,len,u16,
+msgdata,obs_onion_message,onionmsg,byte,len
+msgdata,obs_onion_message,obs_onion_message_tlvs,obs_onion_message_tlvs,
+tlvtype,obs_onion_message_tlvs,blinding,2
+tlvdata,obs_onion_message_tlvs,blinding,blinding,point,

32
wire/onion_printgen.c generated
View File

@ -207,9 +207,9 @@ static const struct tlv_print_record_type print_tlvs_tlv_payload[] = {
{ 8, printwire_tlv_tlv_payload_payment_data },
};
static void printwire_tlv_onionmsg_payload_next_node_id(const char *fieldname, const u8 **cursor, size_t *plen)
static void printwire_tlv_onionmsg_payload_obs_next_node_id(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "next_node_id");
printf("(msg_name=%s)\n", "obs_next_node_id");
printf("node_id=");
struct pubkey node_id;
@ -222,9 +222,9 @@ static void printwire_tlv_onionmsg_payload_next_node_id(const char *fieldname, c
}
}
static void printwire_tlv_onionmsg_payload_next_short_channel_id(const char *fieldname, const u8 **cursor, size_t *plen)
static void printwire_tlv_onionmsg_payload_obs_next_short_channel_id(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "next_short_channel_id");
printf("(msg_name=%s)\n", "obs_next_short_channel_id");
printf("short_channel_id=");
struct short_channel_id short_channel_id;
@ -237,9 +237,9 @@ static void printwire_tlv_onionmsg_payload_next_short_channel_id(const char *fie
}
}
static void printwire_tlv_onionmsg_payload_reply_path(const char *fieldname, const u8 **cursor, size_t *plen)
static void printwire_tlv_onionmsg_payload_obs_reply_path(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "reply_path");
printf("(msg_name=%s)\n", "obs_reply_path");
printf("blinding=");
struct pubkey blinding;
@ -278,9 +278,9 @@ static void printwire_tlv_onionmsg_payload_enctlv(const char *fieldname, const u
}
}
static void printwire_tlv_onionmsg_payload_blinding(const char *fieldname, const u8 **cursor, size_t *plen)
static void printwire_tlv_onionmsg_payload_obs_blinding(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "blinding");
printf("(msg_name=%s)\n", "obs_blinding");
printf("blinding=");
struct pubkey blinding;
@ -334,11 +334,11 @@ static void printwire_tlv_onionmsg_payload_invoice_error(const char *fieldname,
}
static const struct tlv_print_record_type print_tlvs_onionmsg_payload[] = {
{ 4, printwire_tlv_onionmsg_payload_next_node_id },
{ 6, printwire_tlv_onionmsg_payload_next_short_channel_id },
{ 8, printwire_tlv_onionmsg_payload_reply_path },
{ 4, printwire_tlv_onionmsg_payload_obs_next_node_id },
{ 6, printwire_tlv_onionmsg_payload_obs_next_short_channel_id },
{ 8, printwire_tlv_onionmsg_payload_obs_reply_path },
{ 10, printwire_tlv_onionmsg_payload_enctlv },
{ 12, printwire_tlv_onionmsg_payload_blinding },
{ 12, printwire_tlv_onionmsg_payload_obs_blinding },
{ 64, printwire_tlv_onionmsg_payload_invoice_request },
{ 66, printwire_tlv_onionmsg_payload_invoice },
{ 68, printwire_tlv_onionmsg_payload_invoice_error },
@ -359,9 +359,9 @@ static void printwire_tlv_encmsg_tlvs_next_node_id(const char *fieldname, const
}
}
static void printwire_tlv_encmsg_tlvs_next_short_channel_id(const char *fieldname, const u8 **cursor, size_t *plen)
static void printwire_tlv_encmsg_tlvs_obs_next_short_channel_id(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "next_short_channel_id");
printf("(msg_name=%s)\n", "obs_next_short_channel_id");
printf("short_channel_id=");
struct short_channel_id short_channel_id;
@ -377,7 +377,7 @@ static void printwire_tlv_encmsg_tlvs_next_short_channel_id(const char *fieldnam
static const struct tlv_print_record_type print_tlvs_encmsg_tlvs[] = {
{ 4, printwire_tlv_encmsg_tlvs_next_node_id },
{ 6, printwire_tlv_encmsg_tlvs_next_short_channel_id },
{ 6, printwire_tlv_encmsg_tlvs_obs_next_short_channel_id },
};
void printwire_invalid_realm(const char *fieldname, const u8 *cursor)
{
@ -859,4 +859,4 @@ void printonion_wire_tlv_message(const char *tlv_name, const u8 *msg) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_encmsg_tlvs, ARRAY_SIZE(print_tlvs_encmsg_tlvs));
}
}
// SHA256STAMP:5ef4b9da2deee24db844109a2b461c65ad3dbc262da673a304d15082484398e0
// SHA256STAMP:6564b6a17750dfd460f88f9c484964a5fbfdfd77242c1b5c9986e4d69e00d387

2
wire/onion_printgen.h generated
View File

@ -58,4 +58,4 @@ void printwire_mpp_timeout(const char *fieldname, const u8 *cursor);
void printwire_onionmsg_path(const char *fieldname, const u8 **cursor, size_t *plen);
#endif /* LIGHTNING_WIRE_ONION_PRINTGEN_H */
// SHA256STAMP:5ef4b9da2deee24db844109a2b461c65ad3dbc262da673a304d15082484398e0
// SHA256STAMP:6564b6a17750dfd460f88f9c484964a5fbfdfd77242c1b5c9986e4d69e00d387

View File

@ -8,17 +8,17 @@ tlvdata,tlv_payload,short_channel_id,short_channel_id,short_channel_id,
tlvtype,tlv_payload,payment_data,8
tlvdata,tlv_payload,payment_data,payment_secret,byte,32
tlvdata,tlv_payload,payment_data,total_msat,tu64,
tlvtype,onionmsg_payload,next_node_id,4
tlvdata,onionmsg_payload,next_node_id,node_id,point,
tlvtype,onionmsg_payload,next_short_channel_id,6
tlvdata,onionmsg_payload,next_short_channel_id,short_channel_id,short_channel_id,
tlvtype,onionmsg_payload,reply_path,8
tlvdata,onionmsg_payload,reply_path,blinding,point,
tlvdata,onionmsg_payload,reply_path,path,onionmsg_path,...
tlvtype,onionmsg_payload,obs_next_node_id,4
tlvdata,onionmsg_payload,obs_next_node_id,node_id,point,
tlvtype,onionmsg_payload,obs_next_short_channel_id,6
tlvdata,onionmsg_payload,obs_next_short_channel_id,short_channel_id,short_channel_id,
tlvtype,onionmsg_payload,obs_reply_path,8
tlvdata,onionmsg_payload,obs_reply_path,blinding,point,
tlvdata,onionmsg_payload,obs_reply_path,path,onionmsg_path,...
tlvtype,onionmsg_payload,enctlv,10
tlvdata,onionmsg_payload,enctlv,enctlv,byte,...
tlvtype,onionmsg_payload,blinding,12
tlvdata,onionmsg_payload,blinding,blinding,point,
tlvtype,onionmsg_payload,obs_blinding,12
tlvdata,onionmsg_payload,obs_blinding,blinding,point,
tlvtype,onionmsg_payload,invoice_request,64
tlvdata,onionmsg_payload,invoice_request,invoice_request,byte,...
tlvtype,onionmsg_payload,invoice,66
@ -27,8 +27,8 @@ tlvtype,onionmsg_payload,invoice_error,68
tlvdata,onionmsg_payload,invoice_error,invoice_error,byte,...
tlvtype,encmsg_tlvs,next_node_id,4
tlvdata,encmsg_tlvs,next_node_id,node_id,point,
tlvtype,encmsg_tlvs,next_short_channel_id,6
tlvdata,encmsg_tlvs,next_short_channel_id,short_channel_id,short_channel_id,
tlvtype,encmsg_tlvs,obs_next_short_channel_id,6
tlvdata,encmsg_tlvs,obs_next_short_channel_id,short_channel_id,short_channel_id,
subtype,onionmsg_path
subtypedata,onionmsg_path,node_id,point,
subtypedata,onionmsg_path,enclen,u16,

1 #include <wire/onion_defs.h>
8 tlvtype,tlv_payload,payment_data,8
9 tlvdata,tlv_payload,payment_data,payment_secret,byte,32
10 tlvdata,tlv_payload,payment_data,total_msat,tu64,
11 tlvtype,onionmsg_payload,next_node_id,4 tlvtype,onionmsg_payload,obs_next_node_id,4
12 tlvdata,onionmsg_payload,next_node_id,node_id,point, tlvdata,onionmsg_payload,obs_next_node_id,node_id,point,
13 tlvtype,onionmsg_payload,next_short_channel_id,6 tlvtype,onionmsg_payload,obs_next_short_channel_id,6
14 tlvdata,onionmsg_payload,next_short_channel_id,short_channel_id,short_channel_id, tlvdata,onionmsg_payload,obs_next_short_channel_id,short_channel_id,short_channel_id,
15 tlvtype,onionmsg_payload,reply_path,8 tlvtype,onionmsg_payload,obs_reply_path,8
16 tlvdata,onionmsg_payload,reply_path,blinding,point, tlvdata,onionmsg_payload,obs_reply_path,blinding,point,
17 tlvdata,onionmsg_payload,reply_path,path,onionmsg_path,... tlvdata,onionmsg_payload,obs_reply_path,path,onionmsg_path,...
18 tlvtype,onionmsg_payload,enctlv,10
19 tlvdata,onionmsg_payload,enctlv,enctlv,byte,...
20 tlvtype,onionmsg_payload,blinding,12 tlvtype,onionmsg_payload,obs_blinding,12
21 tlvdata,onionmsg_payload,blinding,blinding,point, tlvdata,onionmsg_payload,obs_blinding,blinding,point,
22 tlvtype,onionmsg_payload,invoice_request,64
23 tlvdata,onionmsg_payload,invoice_request,invoice_request,byte,...
24 tlvtype,onionmsg_payload,invoice,66
27 tlvdata,onionmsg_payload,invoice_error,invoice_error,byte,...
28 tlvtype,encmsg_tlvs,next_node_id,4
29 tlvdata,encmsg_tlvs,next_node_id,node_id,point,
30 tlvtype,encmsg_tlvs,next_short_channel_id,6 tlvtype,encmsg_tlvs,obs_next_short_channel_id,6
31 tlvdata,encmsg_tlvs,next_short_channel_id,short_channel_id,short_channel_id, tlvdata,encmsg_tlvs,obs_next_short_channel_id,short_channel_id,short_channel_id,
32 subtype,onionmsg_path
33 subtypedata,onionmsg_path,node_id,point,
34 subtypedata,onionmsg_path,enclen,u16,

92
wire/onion_wiregen.c generated
View File

@ -244,81 +244,81 @@ struct tlv_onionmsg_payload *tlv_onionmsg_payload_new(const tal_t *ctx)
return inst;
}
/* ONIONMSG_PAYLOAD MSG: next_node_id */
static u8 *towire_tlv_onionmsg_payload_next_node_id(const tal_t *ctx, const void *vrecord)
/* ONIONMSG_PAYLOAD MSG: obs_next_node_id */
static u8 *towire_tlv_onionmsg_payload_obs_next_node_id(const tal_t *ctx, const void *vrecord)
{
const struct tlv_onionmsg_payload *r = vrecord;
u8 *ptr;
if (!r->next_node_id)
if (!r->obs_next_node_id)
return NULL;
ptr = tal_arr(ctx, u8, 0);
towire_pubkey(&ptr, r->next_node_id);
towire_pubkey(&ptr, r->obs_next_node_id);
return ptr;
}
static void fromwire_tlv_onionmsg_payload_next_node_id(const u8 **cursor, size_t *plen, void *vrecord)
static void fromwire_tlv_onionmsg_payload_obs_next_node_id(const u8 **cursor, size_t *plen, void *vrecord)
{
struct tlv_onionmsg_payload *r = vrecord;
r->next_node_id = tal(r, struct pubkey);
r->obs_next_node_id = tal(r, struct pubkey);
fromwire_pubkey(cursor, plen, &*r->next_node_id);
fromwire_pubkey(cursor, plen, &*r->obs_next_node_id);
}
/* ONIONMSG_PAYLOAD MSG: next_short_channel_id */
static u8 *towire_tlv_onionmsg_payload_next_short_channel_id(const tal_t *ctx, const void *vrecord)
/* ONIONMSG_PAYLOAD MSG: obs_next_short_channel_id */
static u8 *towire_tlv_onionmsg_payload_obs_next_short_channel_id(const tal_t *ctx, const void *vrecord)
{
const struct tlv_onionmsg_payload *r = vrecord;
u8 *ptr;
if (!r->next_short_channel_id)
if (!r->obs_next_short_channel_id)
return NULL;
ptr = tal_arr(ctx, u8, 0);
towire_short_channel_id(&ptr, r->next_short_channel_id);
towire_short_channel_id(&ptr, r->obs_next_short_channel_id);
return ptr;
}
static void fromwire_tlv_onionmsg_payload_next_short_channel_id(const u8 **cursor, size_t *plen, void *vrecord)
static void fromwire_tlv_onionmsg_payload_obs_next_short_channel_id(const u8 **cursor, size_t *plen, void *vrecord)
{
struct tlv_onionmsg_payload *r = vrecord;
r->next_short_channel_id = tal(r, struct short_channel_id);
r->obs_next_short_channel_id = tal(r, struct short_channel_id);
fromwire_short_channel_id(cursor, plen, &*r->next_short_channel_id);
fromwire_short_channel_id(cursor, plen, &*r->obs_next_short_channel_id);
}
/* ONIONMSG_PAYLOAD MSG: reply_path */
static u8 *towire_tlv_onionmsg_payload_reply_path(const tal_t *ctx, const void *vrecord)
/* ONIONMSG_PAYLOAD MSG: obs_reply_path */
static u8 *towire_tlv_onionmsg_payload_obs_reply_path(const tal_t *ctx, const void *vrecord)
{
const struct tlv_onionmsg_payload *r = vrecord;
u8 *ptr;
if (!r->reply_path)
if (!r->obs_reply_path)
return NULL;
ptr = tal_arr(ctx, u8, 0);
towire_pubkey(&ptr, &r->reply_path->blinding);
towire_pubkey(&ptr, &r->obs_reply_path->blinding);
for (size_t i = 0; i < tal_count(r->reply_path->path); i++)
towire_onionmsg_path(&ptr, r->reply_path->path[i]);
for (size_t i = 0; i < tal_count(r->obs_reply_path->path); i++)
towire_onionmsg_path(&ptr, r->obs_reply_path->path[i]);
return ptr;
}
static void fromwire_tlv_onionmsg_payload_reply_path(const u8 **cursor, size_t *plen, void *vrecord)
static void fromwire_tlv_onionmsg_payload_obs_reply_path(const u8 **cursor, size_t *plen, void *vrecord)
{
struct tlv_onionmsg_payload *r = vrecord;
r->reply_path = tal(r, struct tlv_onionmsg_payload_reply_path);
fromwire_pubkey(cursor, plen, &r->reply_path->blinding);
r->reply_path->path = *plen ? tal_arr(r->reply_path, struct onionmsg_path *, 0) : NULL;
r->obs_reply_path = tal(r, struct tlv_onionmsg_payload_obs_reply_path);
fromwire_pubkey(cursor, plen, &r->obs_reply_path->blinding);
r->obs_reply_path->path = *plen ? tal_arr(r->obs_reply_path, struct onionmsg_path *, 0) : NULL;
for (size_t i = 0; *plen != 0; i++) {
struct onionmsg_path * tmp;
tmp = fromwire_onionmsg_path(r->reply_path, cursor, plen);
tal_arr_expand(&r->reply_path->path, tmp);
tmp = fromwire_onionmsg_path(r->obs_reply_path, cursor, plen);
tal_arr_expand(&r->obs_reply_path->path, tmp);
}
}
/* ONIONMSG_PAYLOAD MSG: enctlv */
@ -343,28 +343,28 @@ static void fromwire_tlv_onionmsg_payload_enctlv(const u8 **cursor, size_t *plen
r->enctlv = tal_arr(r, u8, *plen);
fromwire_u8_array(cursor, plen, r->enctlv, *plen);
}
/* ONIONMSG_PAYLOAD MSG: blinding */
static u8 *towire_tlv_onionmsg_payload_blinding(const tal_t *ctx, const void *vrecord)
/* ONIONMSG_PAYLOAD MSG: obs_blinding */
static u8 *towire_tlv_onionmsg_payload_obs_blinding(const tal_t *ctx, const void *vrecord)
{
const struct tlv_onionmsg_payload *r = vrecord;
u8 *ptr;
if (!r->blinding)
if (!r->obs_blinding)
return NULL;
ptr = tal_arr(ctx, u8, 0);
towire_pubkey(&ptr, r->blinding);
towire_pubkey(&ptr, r->obs_blinding);
return ptr;
}
static void fromwire_tlv_onionmsg_payload_blinding(const u8 **cursor, size_t *plen, void *vrecord)
static void fromwire_tlv_onionmsg_payload_obs_blinding(const u8 **cursor, size_t *plen, void *vrecord)
{
struct tlv_onionmsg_payload *r = vrecord;
r->blinding = tal(r, struct pubkey);
r->obs_blinding = tal(r, struct pubkey);
fromwire_pubkey(cursor, plen, &*r->blinding);
fromwire_pubkey(cursor, plen, &*r->obs_blinding);
}
/* ONIONMSG_PAYLOAD MSG: invoice_request */
static u8 *towire_tlv_onionmsg_payload_invoice_request(const tal_t *ctx, const void *vrecord)
@ -434,11 +434,11 @@ fromwire_u8_array(cursor, plen, r->invoice_error, *plen);
}
static const struct tlv_record_type tlvs_onionmsg_payload[] = {
{ 4, towire_tlv_onionmsg_payload_next_node_id, fromwire_tlv_onionmsg_payload_next_node_id },
{ 6, towire_tlv_onionmsg_payload_next_short_channel_id, fromwire_tlv_onionmsg_payload_next_short_channel_id },
{ 8, towire_tlv_onionmsg_payload_reply_path, fromwire_tlv_onionmsg_payload_reply_path },
{ 4, towire_tlv_onionmsg_payload_obs_next_node_id, fromwire_tlv_onionmsg_payload_obs_next_node_id },
{ 6, towire_tlv_onionmsg_payload_obs_next_short_channel_id, fromwire_tlv_onionmsg_payload_obs_next_short_channel_id },
{ 8, towire_tlv_onionmsg_payload_obs_reply_path, fromwire_tlv_onionmsg_payload_obs_reply_path },
{ 10, towire_tlv_onionmsg_payload_enctlv, fromwire_tlv_onionmsg_payload_enctlv },
{ 12, towire_tlv_onionmsg_payload_blinding, fromwire_tlv_onionmsg_payload_blinding },
{ 12, towire_tlv_onionmsg_payload_obs_blinding, fromwire_tlv_onionmsg_payload_obs_blinding },
{ 64, towire_tlv_onionmsg_payload_invoice_request, fromwire_tlv_onionmsg_payload_invoice_request },
{ 66, towire_tlv_onionmsg_payload_invoice, fromwire_tlv_onionmsg_payload_invoice },
{ 68, towire_tlv_onionmsg_payload_invoice_error, fromwire_tlv_onionmsg_payload_invoice_error },
@ -494,33 +494,33 @@ static void fromwire_tlv_encmsg_tlvs_next_node_id(const u8 **cursor, size_t *ple
fromwire_pubkey(cursor, plen, &*r->next_node_id);
}
/* ENCMSG_TLVS MSG: next_short_channel_id */
static u8 *towire_tlv_encmsg_tlvs_next_short_channel_id(const tal_t *ctx, const void *vrecord)
/* ENCMSG_TLVS MSG: obs_next_short_channel_id */
static u8 *towire_tlv_encmsg_tlvs_obs_next_short_channel_id(const tal_t *ctx, const void *vrecord)
{
const struct tlv_encmsg_tlvs *r = vrecord;
u8 *ptr;
if (!r->next_short_channel_id)
if (!r->obs_next_short_channel_id)
return NULL;
ptr = tal_arr(ctx, u8, 0);
towire_short_channel_id(&ptr, r->next_short_channel_id);
towire_short_channel_id(&ptr, r->obs_next_short_channel_id);
return ptr;
}
static void fromwire_tlv_encmsg_tlvs_next_short_channel_id(const u8 **cursor, size_t *plen, void *vrecord)
static void fromwire_tlv_encmsg_tlvs_obs_next_short_channel_id(const u8 **cursor, size_t *plen, void *vrecord)
{
struct tlv_encmsg_tlvs *r = vrecord;
r->next_short_channel_id = tal(r, struct short_channel_id);
r->obs_next_short_channel_id = tal(r, struct short_channel_id);
fromwire_short_channel_id(cursor, plen, &*r->next_short_channel_id);
fromwire_short_channel_id(cursor, plen, &*r->obs_next_short_channel_id);
}
static const struct tlv_record_type tlvs_encmsg_tlvs[] = {
{ 4, towire_tlv_encmsg_tlvs_next_node_id, fromwire_tlv_encmsg_tlvs_next_node_id },
{ 6, towire_tlv_encmsg_tlvs_next_short_channel_id, fromwire_tlv_encmsg_tlvs_next_short_channel_id },
{ 6, towire_tlv_encmsg_tlvs_obs_next_short_channel_id, fromwire_tlv_encmsg_tlvs_obs_next_short_channel_id },
};
void towire_encmsg_tlvs(u8 **pptr, const struct tlv_encmsg_tlvs *record)
@ -1026,4 +1026,4 @@ bool fromwire_mpp_timeout(const void *p)
return false;
return cursor != NULL;
}
// SHA256STAMP:5ef4b9da2deee24db844109a2b461c65ad3dbc262da673a304d15082484398e0
// SHA256STAMP:6564b6a17750dfd460f88f9c484964a5fbfdfd77242c1b5c9986e4d69e00d387

14
wire/onion_wiregen.h generated
View File

@ -59,7 +59,7 @@ struct tlv_tlv_payload_payment_data {
struct secret payment_secret;
u64 total_msat;
};
struct tlv_onionmsg_payload_reply_path {
struct tlv_onionmsg_payload_obs_reply_path {
struct pubkey blinding;
struct onionmsg_path **path;
};
@ -80,11 +80,11 @@ struct tlv_onionmsg_payload {
/* TODO The following explicit fields could just point into the
* tlv_field entries above to save on memory. */
struct pubkey *next_node_id;
struct short_channel_id *next_short_channel_id;
struct tlv_onionmsg_payload_reply_path *reply_path;
struct pubkey *obs_next_node_id;
struct short_channel_id *obs_next_short_channel_id;
struct tlv_onionmsg_payload_obs_reply_path *obs_reply_path;
u8 *enctlv;
struct pubkey *blinding;
struct pubkey *obs_blinding;
u8 *invoice_request;
u8 *invoice;
u8 *invoice_error;
@ -96,7 +96,7 @@ struct tlv_encmsg_tlvs {
/* TODO The following explicit fields could just point into the
* tlv_field entries above to save on memory. */
struct pubkey *next_node_id;
struct short_channel_id *next_short_channel_id;
struct short_channel_id *obs_next_short_channel_id;
};
struct tlv_tlv_payload *tlv_tlv_payload_new(const tal_t *ctx);
@ -317,4 +317,4 @@ bool fromwire_mpp_timeout(const void *p);
#endif /* LIGHTNING_WIRE_ONION_WIREGEN_H */
// SHA256STAMP:5ef4b9da2deee24db844109a2b461c65ad3dbc262da673a304d15082484398e0
// SHA256STAMP:6564b6a17750dfd460f88f9c484964a5fbfdfd77242c1b5c9986e4d69e00d387

26
wire/peer_printgen.c generated
View File

@ -172,9 +172,9 @@ void printpeer_wire_message(const u8 *msg)
printf("WIRE_GOSSIP_TIMESTAMP_FILTER:\n");
printwire_gossip_timestamp_filter("gossip_timestamp_filter", msg);
return;
case WIRE_ONION_MESSAGE:
printf("WIRE_ONION_MESSAGE:\n");
printwire_onion_message("onion_message", msg);
case WIRE_OBS_ONION_MESSAGE:
printf("WIRE_OBS_ONION_MESSAGE:\n");
printwire_obs_onion_message("obs_onion_message", msg);
return;
}
@ -772,7 +772,7 @@ static const struct tlv_print_record_type print_tlvs_reply_channel_range_tlvs[]
{ 3, printwire_tlv_reply_channel_range_tlvs_checksums_tlv },
};
static void printwire_tlv_onion_message_tlvs_blinding(const char *fieldname, const u8 **cursor, size_t *plen)
static void printwire_tlv_obs_onion_message_tlvs_blinding(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "blinding");
@ -788,8 +788,8 @@ static void printwire_tlv_onion_message_tlvs_blinding(const char *fieldname, con
}
static const struct tlv_print_record_type print_tlvs_onion_message_tlvs[] = {
{ 2, printwire_tlv_onion_message_tlvs_blinding },
static const struct tlv_print_record_type print_tlvs_obs_onion_message_tlvs[] = {
{ 2, printwire_tlv_obs_onion_message_tlvs_blinding },
};
void printwire_init(const char *fieldname, const u8 *cursor)
{
@ -3065,11 +3065,11 @@ void printwire_gossip_timestamp_filter(const char *fieldname, const u8 *cursor)
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_onion_message(const char *fieldname, const u8 *cursor)
void printwire_obs_onion_message(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_ONION_MESSAGE) {
if (fromwire_u16(&cursor, &plen) != WIRE_OBS_ONION_MESSAGE) {
printf("WRONG TYPE?!\n");
return;
}
@ -3086,8 +3086,8 @@ void printwire_onion_message(const char *fieldname, const u8 *cursor)
printf("**TRUNCATED**\n");
return;
}
printf("onion_message_tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.onion_message_tlvs", fieldname), &cursor, &plen, print_tlvs_onion_message_tlvs, ARRAY_SIZE(print_tlvs_onion_message_tlvs));
printf("obs_onion_message_tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.obs_onion_message_tlvs", fieldname), &cursor, &plen, print_tlvs_obs_onion_message_tlvs, ARRAY_SIZE(print_tlvs_obs_onion_message_tlvs));
if (plen != 0)
@ -3135,8 +3135,8 @@ void printpeer_wire_tlv_message(const char *tlv_name, const u8 *msg) {
if (strcmp(tlv_name, "reply_channel_range_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_reply_channel_range_tlvs, ARRAY_SIZE(print_tlvs_reply_channel_range_tlvs));
}
if (strcmp(tlv_name, "onion_message_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_onion_message_tlvs, ARRAY_SIZE(print_tlvs_onion_message_tlvs));
if (strcmp(tlv_name, "obs_onion_message_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_obs_onion_message_tlvs, ARRAY_SIZE(print_tlvs_obs_onion_message_tlvs));
}
}
// SHA256STAMP:30dc0f24cedd3001a2f330446f89575d68b80a2f0c33563bf07093b7bf4196b3
// SHA256STAMP:6d70cc661b9bfd206dc82540e4a53f9c2ef6301355710d1e444acdeaf29c53ef

4
wire/peer_printgen.h generated
View File

@ -90,7 +90,7 @@ void printwire_reply_channel_range(const char *fieldname, const u8 *cursor);
void printwire_gossip_timestamp_filter(const char *fieldname, const u8 *cursor);
void printwire_onion_message(const char *fieldname, const u8 *cursor);
void printwire_obs_onion_message(const char *fieldname, const u8 *cursor);
void printwire_witness_element(const char *fieldname, const u8 **cursor, size_t *plen);
@ -99,4 +99,4 @@ void printwire_channel_update_checksums(const char *fieldname, const u8 **cursor
void printwire_channel_update_timestamps(const char *fieldname, const u8 **cursor, size_t *plen);
void printwire_witness_stack(const char *fieldname, const u8 **cursor, size_t *plen);
#endif /* LIGHTNING_WIRE_PEER_PRINTGEN_H */
// SHA256STAMP:30dc0f24cedd3001a2f330446f89575d68b80a2f0c33563bf07093b7bf4196b3
// SHA256STAMP:6d70cc661b9bfd206dc82540e4a53f9c2ef6301355710d1e444acdeaf29c53ef

View File

@ -33,7 +33,7 @@ static bool unknown_type(enum peer_wire t)
case WIRE_QUERY_CHANNEL_RANGE:
case WIRE_REPLY_CHANNEL_RANGE:
case WIRE_GOSSIP_TIMESTAMP_FILTER:
case WIRE_ONION_MESSAGE:
case WIRE_OBS_ONION_MESSAGE:
case WIRE_TX_ADD_INPUT:
case WIRE_TX_REMOVE_INPUT:
case WIRE_TX_ADD_OUTPUT:
@ -64,7 +64,7 @@ bool is_msg_for_gossipd(const u8 *cursor)
case WIRE_REPLY_CHANNEL_RANGE:
case WIRE_PING:
case WIRE_PONG:
case WIRE_ONION_MESSAGE:
case WIRE_OBS_ONION_MESSAGE:
return true;
case WIRE_WARNING:
case WIRE_INIT:

View File

@ -328,9 +328,9 @@ msgtype,gossip_timestamp_filter,265,gossip_queries
msgdata,gossip_timestamp_filter,chain_hash,chain_hash,
msgdata,gossip_timestamp_filter,first_timestamp,u32,
msgdata,gossip_timestamp_filter,timestamp_range,u32,
msgtype,onion_message,385,option_onion_messages
msgdata,onion_message,len,u16,
msgdata,onion_message,onionmsg,byte,len
msgdata,onion_message,onion_message_tlvs,onion_message_tlvs,
tlvtype,onion_message_tlvs,blinding,2
tlvdata,onion_message_tlvs,blinding,blinding,point,
msgtype,obs_onion_message,385,option_onion_messages
msgdata,obs_onion_message,len,u16,
msgdata,obs_onion_message,onionmsg,byte,len
msgdata,obs_onion_message,obs_onion_message_tlvs,obs_onion_message_tlvs,
tlvtype,obs_onion_message_tlvs,blinding,2
tlvdata,obs_onion_message_tlvs,blinding,blinding,point,

1 msgtype,init,16
328 msgdata,gossip_timestamp_filter,chain_hash,chain_hash,
329 msgdata,gossip_timestamp_filter,first_timestamp,u32,
330 msgdata,gossip_timestamp_filter,timestamp_range,u32,
331 msgtype,onion_message,385,option_onion_messages msgtype,obs_onion_message,385,option_onion_messages
332 msgdata,onion_message,len,u16, msgdata,obs_onion_message,len,u16,
333 msgdata,onion_message,onionmsg,byte,len msgdata,obs_onion_message,onionmsg,byte,len
334 msgdata,onion_message,onion_message_tlvs,onion_message_tlvs, msgdata,obs_onion_message,obs_onion_message_tlvs,obs_onion_message_tlvs,
335 tlvtype,onion_message_tlvs,blinding,2 tlvtype,obs_onion_message_tlvs,blinding,2
336 tlvdata,onion_message_tlvs,blinding,blinding,point, tlvdata,obs_onion_message_tlvs,blinding,blinding,point,

48
wire/peer_wiregen.c generated
View File

@ -60,7 +60,7 @@ const char *peer_wire_name(int e)
case WIRE_QUERY_CHANNEL_RANGE: return "WIRE_QUERY_CHANNEL_RANGE";
case WIRE_REPLY_CHANNEL_RANGE: return "WIRE_REPLY_CHANNEL_RANGE";
case WIRE_GOSSIP_TIMESTAMP_FILTER: return "WIRE_GOSSIP_TIMESTAMP_FILTER";
case WIRE_ONION_MESSAGE: return "WIRE_ONION_MESSAGE";
case WIRE_OBS_ONION_MESSAGE: return "WIRE_OBS_ONION_MESSAGE";
}
snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e);
@ -110,7 +110,7 @@ bool peer_wire_is_defined(u16 type)
case WIRE_QUERY_CHANNEL_RANGE:;
case WIRE_REPLY_CHANNEL_RANGE:;
case WIRE_GOSSIP_TIMESTAMP_FILTER:;
case WIRE_ONION_MESSAGE:;
case WIRE_OBS_ONION_MESSAGE:;
return true;
}
return false;
@ -1179,20 +1179,20 @@ bool reply_channel_range_tlvs_is_valid(const struct tlv_reply_channel_range_tlvs
}
struct tlv_onion_message_tlvs *tlv_onion_message_tlvs_new(const tal_t *ctx)
struct tlv_obs_onion_message_tlvs *tlv_obs_onion_message_tlvs_new(const tal_t *ctx)
{
/* Initialize everything to NULL. (Quiet, C pedants!) */
struct tlv_onion_message_tlvs *inst = talz(ctx, struct tlv_onion_message_tlvs);
struct tlv_obs_onion_message_tlvs *inst = talz(ctx, struct tlv_obs_onion_message_tlvs);
/* Initialized the fields to an empty array. */
inst->fields = tal_arr(inst, struct tlv_field, 0);
return inst;
}
/* ONION_MESSAGE_TLVS MSG: blinding */
static u8 *towire_tlv_onion_message_tlvs_blinding(const tal_t *ctx, const void *vrecord)
/* OBS_ONION_MESSAGE_TLVS MSG: blinding */
static u8 *towire_tlv_obs_onion_message_tlvs_blinding(const tal_t *ctx, const void *vrecord)
{
const struct tlv_onion_message_tlvs *r = vrecord;
const struct tlv_obs_onion_message_tlvs *r = vrecord;
u8 *ptr;
if (!r->blinding)
@ -1204,31 +1204,31 @@ static u8 *towire_tlv_onion_message_tlvs_blinding(const tal_t *ctx, const void *
towire_pubkey(&ptr, r->blinding);
return ptr;
}
static void fromwire_tlv_onion_message_tlvs_blinding(const u8 **cursor, size_t *plen, void *vrecord)
static void fromwire_tlv_obs_onion_message_tlvs_blinding(const u8 **cursor, size_t *plen, void *vrecord)
{
struct tlv_onion_message_tlvs *r = vrecord;
struct tlv_obs_onion_message_tlvs *r = vrecord;
r->blinding = tal(r, struct pubkey);
fromwire_pubkey(cursor, plen, &*r->blinding);
}
static const struct tlv_record_type tlvs_onion_message_tlvs[] = {
{ 2, towire_tlv_onion_message_tlvs_blinding, fromwire_tlv_onion_message_tlvs_blinding },
static const struct tlv_record_type tlvs_obs_onion_message_tlvs[] = {
{ 2, towire_tlv_obs_onion_message_tlvs_blinding, fromwire_tlv_obs_onion_message_tlvs_blinding },
};
void towire_onion_message_tlvs(u8 **pptr, const struct tlv_onion_message_tlvs *record)
void towire_obs_onion_message_tlvs(u8 **pptr, const struct tlv_obs_onion_message_tlvs *record)
{
towire_tlv(pptr, tlvs_onion_message_tlvs, 1, record);
towire_tlv(pptr, tlvs_obs_onion_message_tlvs, 1, record);
}
bool fromwire_onion_message_tlvs(const u8 **cursor, size_t *max, struct tlv_onion_message_tlvs *record)
bool fromwire_obs_onion_message_tlvs(const u8 **cursor, size_t *max, struct tlv_obs_onion_message_tlvs *record)
{
return fromwire_tlv(cursor, max, tlvs_onion_message_tlvs, 1, record, &record->fields);
return fromwire_tlv(cursor, max, tlvs_obs_onion_message_tlvs, 1, record, &record->fields);
}
bool onion_message_tlvs_is_valid(const struct tlv_onion_message_tlvs *record, size_t *err_index)
bool obs_onion_message_tlvs_is_valid(const struct tlv_obs_onion_message_tlvs *record, size_t *err_index)
{
return tlv_fields_valid(record->fields, NULL, err_index);
}
@ -2519,33 +2519,33 @@ bool fromwire_gossip_timestamp_filter(const void *p, struct bitcoin_blkid *chain
return cursor != NULL;
}
/* WIRE: ONION_MESSAGE */
u8 *towire_onion_message(const tal_t *ctx, const u8 *onionmsg, const struct tlv_onion_message_tlvs *onion_message_tlvs)
/* WIRE: OBS_ONION_MESSAGE */
u8 *towire_obs_onion_message(const tal_t *ctx, const u8 *onionmsg, const struct tlv_obs_onion_message_tlvs *obs_onion_message_tlvs)
{
u16 len = tal_count(onionmsg);
u8 *p = tal_arr(ctx, u8, 0);
towire_u16(&p, WIRE_ONION_MESSAGE);
towire_u16(&p, WIRE_OBS_ONION_MESSAGE);
towire_u16(&p, len);
towire_u8_array(&p, onionmsg, len);
towire_onion_message_tlvs(&p, onion_message_tlvs);
towire_obs_onion_message_tlvs(&p, obs_onion_message_tlvs);
return memcheck(p, tal_count(p));
}
bool fromwire_onion_message(const tal_t *ctx, const void *p, u8 **onionmsg, struct tlv_onion_message_tlvs *onion_message_tlvs)
bool fromwire_obs_onion_message(const tal_t *ctx, const void *p, u8 **onionmsg, struct tlv_obs_onion_message_tlvs *obs_onion_message_tlvs)
{
u16 len;
const u8 *cursor = p;
size_t plen = tal_count(p);
if (fromwire_u16(&cursor, &plen) != WIRE_ONION_MESSAGE)
if (fromwire_u16(&cursor, &plen) != WIRE_OBS_ONION_MESSAGE)
return false;
len = fromwire_u16(&cursor, &plen);
// 2nd case onionmsg
*onionmsg = len ? tal_arr(ctx, u8, len) : NULL;
fromwire_u8_array(&cursor, &plen, *onionmsg, len);
fromwire_onion_message_tlvs(&cursor, &plen, onion_message_tlvs);
fromwire_obs_onion_message_tlvs(&cursor, &plen, obs_onion_message_tlvs);
return cursor != NULL;
}
@ -2589,4 +2589,4 @@ bool fromwire_channel_update_option_channel_htlc_max(const void *p, secp256k1_ec
*htlc_maximum_msat = fromwire_amount_msat(&cursor, &plen);
return cursor != NULL;
}
// SHA256STAMP:30dc0f24cedd3001a2f330446f89575d68b80a2f0c33563bf07093b7bf4196b3
// SHA256STAMP:6d70cc661b9bfd206dc82540e4a53f9c2ef6301355710d1e444acdeaf29c53ef

32
wire/peer_wiregen.h generated
View File

@ -57,7 +57,7 @@ enum peer_wire {
WIRE_QUERY_CHANNEL_RANGE = 263,
WIRE_REPLY_CHANNEL_RANGE = 264,
WIRE_GOSSIP_TIMESTAMP_FILTER = 265,
WIRE_ONION_MESSAGE = 385,
WIRE_OBS_ONION_MESSAGE = 385,
};
const char *peer_wire_name(int e);
@ -240,7 +240,7 @@ struct tlv_reply_channel_range_tlvs {
struct tlv_reply_channel_range_tlvs_timestamps_tlv *timestamps_tlv;
struct channel_update_checksums *checksums_tlv;
};
struct tlv_onion_message_tlvs {
struct tlv_obs_onion_message_tlvs {
/* Raw fields including unknown ones. */
struct tlv_field *fields;
@ -754,28 +754,28 @@ void towire_reply_channel_range_tlvs(u8 **pptr, const struct tlv_reply_channel_r
bool reply_channel_range_tlvs_is_valid(const struct tlv_reply_channel_range_tlvs *record,
size_t *err_index);
struct tlv_onion_message_tlvs *tlv_onion_message_tlvs_new(const tal_t *ctx);
struct tlv_obs_onion_message_tlvs *tlv_obs_onion_message_tlvs_new(const tal_t *ctx);
/**
* Deserialize a TLV stream for the onion_message_tlvs namespace.
* Deserialize a TLV stream for the obs_onion_message_tlvs namespace.
*
* This function will parse any TLV stream, as long as the type, length and
* value fields are formatted correctly. Fields that are not known in the
* current namespace are stored in the `fields` member. Validity can be
* checked using onion_message_tlvs_is_valid.
* checked using obs_onion_message_tlvs_is_valid.
*/
bool fromwire_onion_message_tlvs(const u8 **cursor, size_t *max,
struct tlv_onion_message_tlvs * record);
bool fromwire_obs_onion_message_tlvs(const u8 **cursor, size_t *max,
struct tlv_obs_onion_message_tlvs * record);
/**
* Serialize a TLV stream for the onion_message_tlvs namespace.
* Serialize a TLV stream for the obs_onion_message_tlvs namespace.
*
* This function only considers known fields from the onion_message_tlvs namespace,
* This function only considers known fields from the obs_onion_message_tlvs namespace,
* and will ignore any fields that may be stored in the `fields` member. This
* ensures that the resulting stream is valid according to
* `onion_message_tlvs_is_valid`.
* `obs_onion_message_tlvs_is_valid`.
*/
void towire_onion_message_tlvs(u8 **pptr, const struct tlv_onion_message_tlvs *record);
void towire_obs_onion_message_tlvs(u8 **pptr, const struct tlv_obs_onion_message_tlvs *record);
/**
* Check that the TLV stream is valid.
@ -788,7 +788,7 @@ void towire_onion_message_tlvs(u8 **pptr, const struct tlv_onion_message_tlvs *r
* is non-null and we detect an error it is set to the index of the first error
* detected.
*/
bool onion_message_tlvs_is_valid(const struct tlv_onion_message_tlvs *record,
bool obs_onion_message_tlvs_is_valid(const struct tlv_obs_onion_message_tlvs *record,
size_t *err_index);
/* SUBTYPE: WITNESS_ELEMENT */
@ -971,9 +971,9 @@ bool fromwire_reply_channel_range(const tal_t *ctx, const void *p, struct bitcoi
u8 *towire_gossip_timestamp_filter(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, u32 first_timestamp, u32 timestamp_range);
bool fromwire_gossip_timestamp_filter(const void *p, struct bitcoin_blkid *chain_hash, u32 *first_timestamp, u32 *timestamp_range);
/* WIRE: ONION_MESSAGE */
u8 *towire_onion_message(const tal_t *ctx, const u8 *onionmsg, const struct tlv_onion_message_tlvs *onion_message_tlvs);
bool fromwire_onion_message(const tal_t *ctx, const void *p, u8 **onionmsg, struct tlv_onion_message_tlvs *onion_message_tlvs);
/* WIRE: OBS_ONION_MESSAGE */
u8 *towire_obs_onion_message(const tal_t *ctx, const u8 *onionmsg, const struct tlv_obs_onion_message_tlvs *obs_onion_message_tlvs);
bool fromwire_obs_onion_message(const tal_t *ctx, const void *p, u8 **onionmsg, struct tlv_obs_onion_message_tlvs *obs_onion_message_tlvs);
/* WIRE: CHANNEL_UPDATE_OPTION_CHANNEL_HTLC_MAX */
u8 *towire_channel_update_option_channel_htlc_max(const tal_t *ctx, const secp256k1_ecdsa_signature *signature, const struct bitcoin_blkid *chain_hash, const struct short_channel_id *short_channel_id, u32 timestamp, u8 message_flags, u8 channel_flags, u16 cltv_expiry_delta, struct amount_msat htlc_minimum_msat, u32 fee_base_msat, u32 fee_proportional_millionths, struct amount_msat htlc_maximum_msat);
@ -981,4 +981,4 @@ bool fromwire_channel_update_option_channel_htlc_max(const void *p, secp256k1_ec
#endif /* LIGHTNING_WIRE_PEER_WIREGEN_H */
// SHA256STAMP:30dc0f24cedd3001a2f330446f89575d68b80a2f0c33563bf07093b7bf4196b3
// SHA256STAMP:6d70cc661b9bfd206dc82540e4a53f9c2ef6301355710d1e444acdeaf29c53ef