Skip to content

Commit e3ae788

Browse files
committed
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>
1 parent f31f7b1 commit e3ae788

19 files changed

+196
-196
lines changed

channeld/channeld.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2270,7 +2270,7 @@ static void peer_in(struct peer *peer, const u8 *msg)
22702270
case WIRE_PONG:
22712271
case WIRE_WARNING:
22722272
case WIRE_ERROR:
2273-
case WIRE_ONION_MESSAGE:
2273+
case WIRE_OBS_ONION_MESSAGE:
22742274
abort();
22752275
}
22762276

devtools/blindedpath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ int main(int argc, char **argv)
146146
inner = tlv_encmsg_tlvs_new(tmpctx);
147147
/* Use scid if they provided one */
148148
if (scids[i]) {
149-
inner->next_short_channel_id
149+
inner->obs_next_short_channel_id
150150
= tal_dup(inner, struct short_channel_id,
151151
scids[i]);
152152
} else {

gossipd/gossipd.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ static bool handle_local_channel_announcement(struct daemon *daemon,
381381
}
382382

383383
/* Peer sends onion msg. */
384-
static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
384+
static u8 *handle_obs_onion_message(struct peer *peer, const u8 *msg)
385385
{
386386
enum onion_wire badreason;
387387
struct onionpacket *op;
@@ -392,15 +392,15 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
392392
const u8 *cursor;
393393
size_t max, maxlen;
394394
struct tlv_onionmsg_payload *om;
395-
struct tlv_onion_message_tlvs *tlvs = tlv_onion_message_tlvs_new(msg);
395+
struct tlv_obs_onion_message_tlvs *tlvs = tlv_obs_onion_message_tlvs_new(msg);
396396

397397
/* Ignore unless explicitly turned on. */
398398
if (!feature_offered(peer->daemon->our_features->bits[NODE_ANNOUNCE_FEATURE],
399399
OPT_ONION_MESSAGES))
400400
return NULL;
401401

402402
/* FIXME: ratelimit! */
403-
if (!fromwire_onion_message(msg, msg, &onion, tlvs))
403+
if (!fromwire_obs_onion_message(msg, msg, &onion, tlvs))
404404
return towire_warningfmt(peer, NULL, "Bad onion_message");
405405

406406
/* We unwrap the onion now. */
@@ -480,9 +480,9 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
480480
}
481481

482482
/* If we weren't given a blinding factor, tlv can provide one. */
483-
if (om->blinding && !blinding_ss) {
483+
if (om->obs_blinding && !blinding_ss) {
484484
/* E(i) */
485-
blinding_in = tal_dup(msg, struct pubkey, om->blinding);
485+
blinding_in = tal_dup(msg, struct pubkey, om->obs_blinding);
486486
blinding_ss = tal(msg, struct secret);
487487

488488
ecdh(blinding_in, blinding_ss);
@@ -554,10 +554,10 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
554554
const struct onionmsg_path **path;
555555
u8 *omsg;
556556

557-
if (om->reply_path) {
558-
blinding = &om->reply_path->blinding;
557+
if (om->obs_reply_path) {
558+
blinding = &om->obs_reply_path->blinding;
559559
path = cast_const2(const struct onionmsg_path **,
560-
om->reply_path->path);
560+
om->obs_reply_path->path);
561561
} else {
562562
blinding = NULL;
563563
path = NULL;
@@ -577,7 +577,7 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
577577
struct node_id *next_node;
578578

579579
/* This *MUST* have instructions on where to go next. */
580-
if (!om->next_short_channel_id && !om->next_node_id) {
580+
if (!om->obs_next_short_channel_id && !om->obs_next_node_id) {
581581
status_debug("peer %s: onion msg: no next field in %s",
582582
type_to_string(tmpctx, struct node_id, &peer->id),
583583
tal_hex(tmpctx, rs->raw_payload));
@@ -593,15 +593,15 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg)
593593
} else
594594
next_blinding = NULL;
595595

596-
if (om->next_node_id) {
596+
if (om->obs_next_node_id) {
597597
next_node = tal(tmpctx, struct node_id);
598-
node_id_from_pubkey(next_node, om->next_node_id);
598+
node_id_from_pubkey(next_node, om->obs_next_node_id);
599599
} else
600600
next_node = NULL;
601601

602602
daemon_conn_send(peer->daemon->master,
603603
take(towire_gossipd_got_onionmsg_forward(NULL,
604-
om->next_short_channel_id,
604+
om->obs_next_short_channel_id,
605605
next_node,
606606
next_blinding,
607607
serialize_onionpacket(tmpctx, rs->next))));
@@ -627,14 +627,14 @@ static struct io_plan *onionmsg_req(struct io_conn *conn, struct daemon *daemon,
627627
* handle it here with 'sent' = false. */
628628
peer = find_peer(daemon, &id);
629629
if (peer) {
630-
struct tlv_onion_message_tlvs *tlvs;
630+
struct tlv_obs_onion_message_tlvs *tlvs;
631631

632-
tlvs = tlv_onion_message_tlvs_new(msg);
632+
tlvs = tlv_obs_onion_message_tlvs_new(msg);
633633
if (blinding)
634634
tlvs->blinding = tal_dup(tlvs, struct pubkey, blinding);
635635

636636
queue_peer_msg(peer,
637-
take(towire_onion_message(NULL,
637+
take(towire_obs_onion_message(NULL,
638638
onion_routing_packet,
639639
tlvs)));
640640
}
@@ -680,8 +680,8 @@ static struct io_plan *peer_msg_in(struct io_conn *conn,
680680
case WIRE_PONG:
681681
err = handle_pong(peer, msg);
682682
goto handled_relay;
683-
case WIRE_ONION_MESSAGE:
684-
err = handle_onion_message(peer, msg);
683+
case WIRE_OBS_ONION_MESSAGE:
684+
err = handle_obs_onion_message(peer, msg);
685685
goto handled_relay;
686686

687687
/* These are non-gossip messages (!is_msg_for_gossipd()) */

lightningd/onion_message.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,12 @@ static struct command_result *param_reply_path(struct command *cmd,
291291
const char *name,
292292
const char *buffer,
293293
const jsmntok_t *tok,
294-
struct tlv_onionmsg_payload_reply_path **reply_path)
294+
struct tlv_onionmsg_payload_obs_reply_path **reply_path)
295295
{
296296
const jsmntok_t *tblinding, *tpath, *t;
297297
size_t i;
298298

299-
*reply_path = tal(cmd, struct tlv_onionmsg_payload_reply_path);
299+
*reply_path = tal(cmd, struct tlv_onionmsg_payload_obs_reply_path);
300300
tblinding = json_get_member(buffer, tok, "blinding");
301301
if (!tblinding)
302302
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
@@ -351,7 +351,7 @@ static struct command_result *param_reply_path(struct command *cmd,
351351

352352
/* Generate ->rawtlv if not already supplied. */
353353
static void populate_tlvs(struct hop *hops,
354-
struct tlv_onionmsg_payload_reply_path *reply_path)
354+
struct tlv_onionmsg_payload_obs_reply_path *reply_path)
355355
{
356356
for (size_t i = 0; i < tal_count(hops); i++) {
357357
struct tlv_onionmsg_payload *tlv;
@@ -362,16 +362,16 @@ static void populate_tlvs(struct hop *hops,
362362
tlv = tlv_onionmsg_payload_new(tmpctx);
363363
/* If they don't give scid, use next node id */
364364
if (hops[i].scid) {
365-
tlv->next_short_channel_id
365+
tlv->obs_next_short_channel_id
366366
= tal_dup(tlv, struct short_channel_id,
367367
hops[i].scid);
368368
} else if (i != tal_count(hops)-1) {
369-
tlv->next_node_id = tal_dup(tlv, struct pubkey,
370-
&hops[i+1].id);
369+
tlv->obs_next_node_id = tal_dup(tlv, struct pubkey,
370+
&hops[i+1].id);
371371
}
372372
if (hops[i].blinding) {
373-
tlv->blinding = tal_dup(tlv, struct pubkey,
374-
hops[i].blinding);
373+
tlv->obs_blinding = tal_dup(tlv, struct pubkey,
374+
hops[i].blinding);
375375
}
376376
/* Note: tal_dup_talarr returns NULL for NULL */
377377
tlv->enctlv = tal_dup_talarr(tlv, u8, hops[i].enctlv);
@@ -382,7 +382,7 @@ static void populate_tlvs(struct hop *hops,
382382
hops[i].invoice_err);
383383

384384
if (i == tal_count(hops)-1 && reply_path)
385-
tlv->reply_path = reply_path;
385+
tlv->obs_reply_path = reply_path;
386386

387387
hops[i].rawtlv = tal_arr(hops, u8, 0);
388388
towire_onionmsg_payload(&hops[i].rawtlv, tlv);
@@ -395,7 +395,7 @@ static struct command_result *json_send_onion_message(struct command *cmd,
395395
const jsmntok_t *params)
396396
{
397397
struct hop *hops;
398-
struct tlv_onionmsg_payload_reply_path *reply_path;
398+
struct tlv_onionmsg_payload_obs_reply_path *reply_path;
399399
struct sphinx_path *sphinx_path;
400400
struct onionpacket *op;
401401
struct secret *path_secrets;

openingd/dualopend.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state)
12831283
case WIRE_CHANNEL_REESTABLISH:
12841284
case WIRE_ANNOUNCEMENT_SIGNATURES:
12851285
case WIRE_GOSSIP_TIMESTAMP_FILTER:
1286-
case WIRE_ONION_MESSAGE:
1286+
case WIRE_OBS_ONION_MESSAGE:
12871287
case WIRE_ACCEPT_CHANNEL2:
12881288
case WIRE_TX_ADD_INPUT:
12891289
case WIRE_TX_REMOVE_INPUT:
@@ -1631,7 +1631,7 @@ static bool run_tx_interactive(struct state *state,
16311631
case WIRE_CHANNEL_REESTABLISH:
16321632
case WIRE_ANNOUNCEMENT_SIGNATURES:
16331633
case WIRE_GOSSIP_TIMESTAMP_FILTER:
1634-
case WIRE_ONION_MESSAGE:
1634+
case WIRE_OBS_ONION_MESSAGE:
16351635
case WIRE_TX_SIGNATURES:
16361636
case WIRE_OPEN_CHANNEL2:
16371637
case WIRE_ACCEPT_CHANNEL2:
@@ -3689,7 +3689,7 @@ static u8 *handle_peer_in(struct state *state)
36893689
case WIRE_CHANNEL_REESTABLISH:
36903690
case WIRE_ANNOUNCEMENT_SIGNATURES:
36913691
case WIRE_GOSSIP_TIMESTAMP_FILTER:
3692-
case WIRE_ONION_MESSAGE:
3692+
case WIRE_OBS_ONION_MESSAGE:
36933693
case WIRE_ACCEPT_CHANNEL2:
36943694
case WIRE_TX_ADD_INPUT:
36953695
case WIRE_TX_REMOVE_INPUT:

wire/extracted_onion_01_offers.patch

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
tlvtype,tlv_payload,payment_data,8
55
tlvdata,tlv_payload,payment_data,payment_secret,byte,32
66
tlvdata,tlv_payload,payment_data,total_msat,tu64,
7-
+tlvtype,onionmsg_payload,next_node_id,4
8-
+tlvdata,onionmsg_payload,next_node_id,node_id,point,
9-
+tlvtype,onionmsg_payload,next_short_channel_id,6
10-
+tlvdata,onionmsg_payload,next_short_channel_id,short_channel_id,short_channel_id,
11-
+tlvtype,onionmsg_payload,reply_path,8
12-
+tlvdata,onionmsg_payload,reply_path,blinding,point,
13-
+tlvdata,onionmsg_payload,reply_path,path,onionmsg_path,...
7+
+tlvtype,onionmsg_payload,obs_next_node_id,4
8+
+tlvdata,onionmsg_payload,obs_next_node_id,node_id,point,
9+
+tlvtype,onionmsg_payload,obs_next_short_channel_id,6
10+
+tlvdata,onionmsg_payload,obs_next_short_channel_id,short_channel_id,short_channel_id,
11+
+tlvtype,onionmsg_payload,obs_reply_path,8
12+
+tlvdata,onionmsg_payload,obs_reply_path,blinding,point,
13+
+tlvdata,onionmsg_payload,obs_reply_path,path,onionmsg_path,...
1414
+tlvtype,onionmsg_payload,enctlv,10
1515
+tlvdata,onionmsg_payload,enctlv,enctlv,byte,...
16-
+tlvtype,onionmsg_payload,blinding,12
17-
+tlvdata,onionmsg_payload,blinding,blinding,point,
16+
+tlvtype,onionmsg_payload,obs_blinding,12
17+
+tlvdata,onionmsg_payload,obs_blinding,blinding,point,
1818
+tlvtype,onionmsg_payload,invoice_request,64
1919
+tlvdata,onionmsg_payload,invoice_request,invoice_request,byte,...
2020
+tlvtype,onionmsg_payload,invoice,66
@@ -23,8 +23,8 @@
2323
+tlvdata,onionmsg_payload,invoice_error,invoice_error,byte,...
2424
+tlvtype,encmsg_tlvs,next_node_id,4
2525
+tlvdata,encmsg_tlvs,next_node_id,node_id,point,
26-
+tlvtype,encmsg_tlvs,next_short_channel_id,6
27-
+tlvdata,encmsg_tlvs,next_short_channel_id,short_channel_id,short_channel_id,
26+
+tlvtype,encmsg_tlvs,obs_next_short_channel_id,6
27+
+tlvdata,encmsg_tlvs,obs_next_short_channel_id,short_channel_id,short_channel_id,
2828
+subtype,onionmsg_path
2929
+subtypedata,onionmsg_path,node_id,point,
3030
+subtypedata,onionmsg_path,enclen,u16,

wire/extracted_onion_exp_enctlv.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
+tlvdata,tlv_payload,enctlv,enctlv,byte,...
99
+tlvtype,tlv_payload,blinding_seed,12
1010
+tlvdata,tlv_payload,blinding_seed,blinding_seed,pubkey,
11-
tlvtype,onionmsg_payload,next_node_id,4
12-
tlvdata,onionmsg_payload,next_node_id,node_id,point,
13-
tlvtype,onionmsg_payload,next_short_channel_id,6
11+
tlvtype,onionmsg_payload,obs_next_node_id,4
12+
tlvdata,onionmsg_payload,obs_next_node_id,node_id,point,
13+
tlvtype,onionmsg_payload,obs_next_short_channel_id,6
1414

wire/extracted_peer_01_offers.patch

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
msgdata,gossip_timestamp_filter,chain_hash,chain_hash,
55
msgdata,gossip_timestamp_filter,first_timestamp,u32,
66
msgdata,gossip_timestamp_filter,timestamp_range,u32,
7-
+msgtype,onion_message,385,option_onion_messages
8-
+msgdata,onion_message,len,u16,
9-
+msgdata,onion_message,onionmsg,byte,len
10-
+msgdata,onion_message,onion_message_tlvs,onion_message_tlvs,
11-
+tlvtype,onion_message_tlvs,blinding,2
12-
+tlvdata,onion_message_tlvs,blinding,blinding,point,
7+
+msgtype,obs_onion_message,385,option_onion_messages
8+
+msgdata,obs_onion_message,len,u16,
9+
+msgdata,obs_onion_message,onionmsg,byte,len
10+
+msgdata,obs_onion_message,obs_onion_message_tlvs,obs_onion_message_tlvs,
11+
+tlvtype,obs_onion_message_tlvs,blinding,2
12+
+tlvdata,obs_onion_message_tlvs,blinding,blinding,point,

wire/onion_printgen.c

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

wire/onion_printgen.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)