Skip to content

Commit 191798b

Browse files
committed
gossipd: rename onionmsg messages to lightningd to obs_onionmsg.
The new ones are slightly different. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent e3ae788 commit 191798b

File tree

7 files changed

+90
-90
lines changed

7 files changed

+90
-90
lines changed

gossipd/gossipd.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ static u8 *handle_obs_onion_message(struct peer *peer, const u8 *msg)
567567
omsg = tal_arr(tmpctx, u8, 0);
568568
towire_tlvstream_raw(&omsg, om->fields);
569569
daemon_conn_send(peer->daemon->master,
570-
take(towire_gossipd_got_onionmsg_to_us(NULL,
570+
take(towire_gossipd_got_obs_onionmsg_to_us(NULL,
571571
blinding_in,
572572
blinding,
573573
path,
@@ -600,7 +600,7 @@ static u8 *handle_obs_onion_message(struct peer *peer, const u8 *msg)
600600
next_node = NULL;
601601

602602
daemon_conn_send(peer->daemon->master,
603-
take(towire_gossipd_got_onionmsg_forward(NULL,
603+
take(towire_gossipd_got_obs_onionmsg_forward(NULL,
604604
om->obs_next_short_channel_id,
605605
next_node,
606606
next_blinding,
@@ -609,18 +609,18 @@ static u8 *handle_obs_onion_message(struct peer *peer, const u8 *msg)
609609
return NULL;
610610
}
611611

612-
/* We send onion msg. */
613-
static struct io_plan *onionmsg_req(struct io_conn *conn, struct daemon *daemon,
612+
/* We send an obsolete onion msg. */
613+
static struct io_plan *obs_onionmsg_req(struct io_conn *conn, struct daemon *daemon,
614614
const u8 *msg)
615615
{
616616
struct node_id id;
617617
u8 *onion_routing_packet;
618618
struct pubkey *blinding;
619619
struct peer *peer;
620620

621-
if (!fromwire_gossipd_send_onionmsg(msg, msg, &id, &onion_routing_packet,
621+
if (!fromwire_gossipd_send_obs_onionmsg(msg, msg, &id, &onion_routing_packet,
622622
&blinding))
623-
master_badmsg(WIRE_GOSSIPD_SEND_ONIONMSG, msg);
623+
master_badmsg(WIRE_GOSSIPD_SEND_OBS_ONIONMSG, msg);
624624

625625
/* Even if lightningd were to check for valid ids, there's a race
626626
* where it might vanish before we read this command; cleaner to
@@ -1507,17 +1507,17 @@ static struct io_plan *recv_req(struct io_conn *conn,
15071507
break;
15081508
#endif /* !DEVELOPER */
15091509

1510-
case WIRE_GOSSIPD_SEND_ONIONMSG:
1511-
return onionmsg_req(conn, daemon, msg);
1510+
case WIRE_GOSSIPD_SEND_OBS_ONIONMSG:
1511+
return obs_onionmsg_req(conn, daemon, msg);
15121512
/* We send these, we don't receive them */
15131513
case WIRE_GOSSIPD_PING_REPLY:
15141514
case WIRE_GOSSIPD_INIT_REPLY:
15151515
case WIRE_GOSSIPD_GET_STRIPPED_CUPDATE_REPLY:
15161516
case WIRE_GOSSIPD_GET_TXOUT:
15171517
case WIRE_GOSSIPD_DEV_MEMLEAK_REPLY:
15181518
case WIRE_GOSSIPD_DEV_COMPACT_STORE_REPLY:
1519-
case WIRE_GOSSIPD_GOT_ONIONMSG_TO_US:
1520-
case WIRE_GOSSIPD_GOT_ONIONMSG_FORWARD:
1519+
case WIRE_GOSSIPD_GOT_OBS_ONIONMSG_TO_US:
1520+
case WIRE_GOSSIPD_GOT_OBS_ONIONMSG_FORWARD:
15211521
case WIRE_GOSSIPD_ADDGOSSIP_REPLY:
15221522
break;
15231523
}

gossipd/gossipd_wire.csv

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,28 @@ msgdata,gossipd_dev_compact_store_reply,success,bool,
8787
msgtype,gossipd_new_blockheight,3026
8888
msgdata,gossipd_new_blockheight,blockheight,u32,
8989

90-
# Tell lightningd we got a onion message (for us, or to fwd)
91-
msgtype,gossipd_got_onionmsg_to_us,3142
92-
msgdata,gossipd_got_onionmsg_to_us,blinding_in,?pubkey,
93-
msgdata,gossipd_got_onionmsg_to_us,reply_blinding,?pubkey,
94-
msgdata,gossipd_got_onionmsg_to_us,reply_path_len,u16,
95-
msgdata,gossipd_got_onionmsg_to_us,reply_path,onionmsg_path,reply_path_len
96-
msgdata,gossipd_got_onionmsg_to_us,rawmsg_len,u16,
97-
msgdata,gossipd_got_onionmsg_to_us,rawmsg,u8,rawmsg_len
98-
99-
msgtype,gossipd_got_onionmsg_forward,3143
100-
msgdata,gossipd_got_onionmsg_forward,next_scid,?short_channel_id,
101-
msgdata,gossipd_got_onionmsg_forward,next_node_id,?node_id,
102-
msgdata,gossipd_got_onionmsg_forward,next_blinding,?pubkey,
103-
msgdata,gossipd_got_onionmsg_forward,next_onion_len,u16,
104-
msgdata,gossipd_got_onionmsg_forward,next_onion,u8,next_onion_len
90+
# Tell lightningd we got an obsolete onion message (for us, or to fwd)
91+
msgtype,gossipd_got_obs_onionmsg_to_us,3142
92+
msgdata,gossipd_got_obs_onionmsg_to_us,blinding_in,?pubkey,
93+
msgdata,gossipd_got_obs_onionmsg_to_us,reply_blinding,?pubkey,
94+
msgdata,gossipd_got_obs_onionmsg_to_us,reply_path_len,u16,
95+
msgdata,gossipd_got_obs_onionmsg_to_us,reply_path,onionmsg_path,reply_path_len
96+
msgdata,gossipd_got_obs_onionmsg_to_us,rawmsg_len,u16,
97+
msgdata,gossipd_got_obs_onionmsg_to_us,rawmsg,u8,rawmsg_len
98+
99+
msgtype,gossipd_got_obs_onionmsg_forward,3143
100+
msgdata,gossipd_got_obs_onionmsg_forward,next_scid,?short_channel_id,
101+
msgdata,gossipd_got_obs_onionmsg_forward,next_node_id,?node_id,
102+
msgdata,gossipd_got_obs_onionmsg_forward,next_blinding,?pubkey,
103+
msgdata,gossipd_got_obs_onionmsg_forward,next_onion_len,u16,
104+
msgdata,gossipd_got_obs_onionmsg_forward,next_onion,u8,next_onion_len
105105

106106
# Lightningd tells us to send a onion message.
107-
msgtype,gossipd_send_onionmsg,3040
108-
msgdata,gossipd_send_onionmsg,id,node_id,
109-
msgdata,gossipd_send_onionmsg,onion_len,u16,
110-
msgdata,gossipd_send_onionmsg,onion,u8,onion_len
111-
msgdata,gossipd_send_onionmsg,blinding,?pubkey,
107+
msgtype,gossipd_send_obs_onionmsg,3040
108+
msgdata,gossipd_send_obs_onionmsg,id,node_id,
109+
msgdata,gossipd_send_obs_onionmsg,onion_len,u16,
110+
msgdata,gossipd_send_obs_onionmsg,onion,u8,onion_len
111+
msgdata,gossipd_send_obs_onionmsg,blinding,?pubkey,
112112

113113
# Lightningd tells us to inject a gossip message (for addgossip RPC)
114114
msgtype,gossipd_addgossip,3044

gossipd/gossipd_wiregen.c

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

gossipd/gossipd_wiregen.h

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

lightningd/gossip_control.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static unsigned gossip_msg(struct subd *gossip, const u8 *msg, const int *fds)
125125
case WIRE_GOSSIPD_DEV_COMPACT_STORE:
126126
case WIRE_GOSSIPD_DEV_SET_TIME:
127127
case WIRE_GOSSIPD_NEW_BLOCKHEIGHT:
128-
case WIRE_GOSSIPD_SEND_ONIONMSG:
128+
case WIRE_GOSSIPD_SEND_OBS_ONIONMSG:
129129
case WIRE_GOSSIPD_ADDGOSSIP:
130130
/* This is a reply, so never gets through to here. */
131131
case WIRE_GOSSIPD_INIT_REPLY:
@@ -135,11 +135,11 @@ static unsigned gossip_msg(struct subd *gossip, const u8 *msg, const int *fds)
135135
case WIRE_GOSSIPD_ADDGOSSIP_REPLY:
136136
break;
137137

138-
case WIRE_GOSSIPD_GOT_ONIONMSG_TO_US:
139-
handle_onionmsg_to_us(gossip->ld, msg);
138+
case WIRE_GOSSIPD_GOT_OBS_ONIONMSG_TO_US:
139+
handle_obs_onionmsg_to_us(gossip->ld, msg);
140140
break;
141-
case WIRE_GOSSIPD_GOT_ONIONMSG_FORWARD:
142-
handle_onionmsg_forward(gossip->ld, msg);
141+
case WIRE_GOSSIPD_GOT_OBS_ONIONMSG_FORWARD:
142+
handle_obs_onionmsg_forward(gossip->ld, msg);
143143
break;
144144
case WIRE_GOSSIPD_PING_REPLY:
145145
ping_reply(gossip, msg);

lightningd/onion_message.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ REGISTER_PLUGIN_HOOK(onion_message_blinded,
8989
onion_message_serialize,
9090
struct onion_message_hook_payload *);
9191

92-
void handle_onionmsg_to_us(struct lightningd *ld, const u8 *msg)
92+
void handle_obs_onionmsg_to_us(struct lightningd *ld, const u8 *msg)
9393
{
9494
struct onion_message_hook_payload *payload;
9595
u8 *submsg;
@@ -99,11 +99,11 @@ void handle_onionmsg_to_us(struct lightningd *ld, const u8 *msg)
9999
payload = tal(ld, struct onion_message_hook_payload);
100100
payload->om = tlv_onionmsg_payload_new(payload);
101101

102-
if (!fromwire_gossipd_got_onionmsg_to_us(payload, msg,
103-
&payload->blinding_in,
104-
&payload->reply_blinding,
105-
&payload->reply_path,
106-
&submsg)) {
102+
if (!fromwire_gossipd_got_obs_onionmsg_to_us(payload, msg,
103+
&payload->blinding_in,
104+
&payload->reply_blinding,
105+
&payload->reply_path,
106+
&submsg)) {
107107
log_broken(ld->log, "bad got_onionmsg_tous: %s",
108108
tal_hex(tmpctx, msg));
109109
return;
@@ -135,16 +135,16 @@ void handle_onionmsg_to_us(struct lightningd *ld, const u8 *msg)
135135
plugin_hook_call_onion_message(ld, payload);
136136
}
137137

138-
void handle_onionmsg_forward(struct lightningd *ld, const u8 *msg)
138+
void handle_obs_onionmsg_forward(struct lightningd *ld, const u8 *msg)
139139
{
140140
struct short_channel_id *next_scid;
141141
struct node_id *next_node;
142142
struct pubkey *next_blinding;
143143
u8 *onion;
144144

145-
if (!fromwire_gossipd_got_onionmsg_forward(msg, msg, &next_scid,
146-
&next_node,
147-
&next_blinding, &onion)) {
145+
if (!fromwire_gossipd_got_obs_onionmsg_forward(msg, msg, &next_scid,
146+
&next_node,
147+
&next_blinding, &onion)) {
148148
log_broken(ld->log, "bad got_onionmsg_forward: %s",
149149
tal_hex(tmpctx, msg));
150150
return;
@@ -164,10 +164,10 @@ void handle_onionmsg_forward(struct lightningd *ld, const u8 *msg)
164164
: "unspecified dest");
165165
} else {
166166
subd_send_msg(ld->gossip,
167-
take(towire_gossipd_send_onionmsg(NULL,
168-
next_node,
169-
onion,
170-
next_blinding)));
167+
take(towire_gossipd_send_obs_onionmsg(NULL,
168+
next_node,
169+
onion,
170+
next_blinding)));
171171
}
172172
}
173173

@@ -440,7 +440,7 @@ static struct command_result *json_send_onion_message(struct command *cmd,
440440
"Creating onion failed (tlvs too long?)");
441441

442442
subd_send_msg(cmd->ld->gossip,
443-
take(towire_gossipd_send_onionmsg(NULL, &first_id,
443+
take(towire_gossipd_send_obs_onionmsg(NULL, &first_id,
444444
serialize_onionpacket(tmpctx, op),
445445
NULL)));
446446

0 commit comments

Comments
 (0)