mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
channeld: hand input blinding to lightningd.
Required to determine if this msg used expected reply path. Also remove FIXME (om->enctlv is handled above). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
54c57e7495
commit
61422193d9
5 changed files with 24 additions and 11 deletions
|
@ -1950,11 +1950,6 @@ static void handle_onion_message(struct peer *peer, const u8 *msg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (om->enctlv) {
|
|
||||||
status_broken("FIXME: Handle enctlv!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rs->nextcase == ONION_END) {
|
if (rs->nextcase == ONION_END) {
|
||||||
struct pubkey *blinding;
|
struct pubkey *blinding;
|
||||||
const struct onionmsg_path **path;
|
const struct onionmsg_path **path;
|
||||||
|
@ -1969,6 +1964,7 @@ static void handle_onion_message(struct peer *peer, const u8 *msg)
|
||||||
}
|
}
|
||||||
wire_sync_write(MASTER_FD,
|
wire_sync_write(MASTER_FD,
|
||||||
take(towire_got_onionmsg_to_us(NULL,
|
take(towire_got_onionmsg_to_us(NULL,
|
||||||
|
blinding_in,
|
||||||
blinding,
|
blinding,
|
||||||
path)));
|
path)));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -227,6 +227,7 @@ msgtype,channeld_send_error_reply,1108
|
||||||
|
|
||||||
# Tell lightningd we got a onion message (for us, or to fwd)
|
# Tell lightningd we got a onion message (for us, or to fwd)
|
||||||
msgtype,got_onionmsg_to_us,1142
|
msgtype,got_onionmsg_to_us,1142
|
||||||
|
msgdata,got_onionmsg_to_us,blinding_in,?pubkey,
|
||||||
msgdata,got_onionmsg_to_us,reply_blinding,?pubkey,
|
msgdata,got_onionmsg_to_us,reply_blinding,?pubkey,
|
||||||
msgdata,got_onionmsg_to_us,reply_path_len,u16,
|
msgdata,got_onionmsg_to_us,reply_path_len,u16,
|
||||||
msgdata,got_onionmsg_to_us,reply_path,onionmsg_path,reply_path_len
|
msgdata,got_onionmsg_to_us,reply_path,onionmsg_path,reply_path_len
|
||||||
|
|
Can't render this file because it has a wrong number of fields in line 12.
|
18
channeld/channeld_wiregen.c
generated
18
channeld/channeld_wiregen.c
generated
|
@ -1105,12 +1105,18 @@ bool fromwire_channeld_send_error_reply(const void *p)
|
||||||
|
|
||||||
/* WIRE: GOT_ONIONMSG_TO_US */
|
/* WIRE: GOT_ONIONMSG_TO_US */
|
||||||
/* Tell lightningd we got a onion message (for us */
|
/* Tell lightningd we got a onion message (for us */
|
||||||
u8 *towire_got_onionmsg_to_us(const tal_t *ctx, const struct pubkey *reply_blinding, const struct onionmsg_path **reply_path)
|
u8 *towire_got_onionmsg_to_us(const tal_t *ctx, const struct pubkey *blinding_in, const struct pubkey *reply_blinding, const struct onionmsg_path **reply_path)
|
||||||
{
|
{
|
||||||
u16 reply_path_len = tal_count(reply_path);
|
u16 reply_path_len = tal_count(reply_path);
|
||||||
u8 *p = tal_arr(ctx, u8, 0);
|
u8 *p = tal_arr(ctx, u8, 0);
|
||||||
|
|
||||||
towire_u16(&p, WIRE_GOT_ONIONMSG_TO_US);
|
towire_u16(&p, WIRE_GOT_ONIONMSG_TO_US);
|
||||||
|
if (!blinding_in)
|
||||||
|
towire_bool(&p, false);
|
||||||
|
else {
|
||||||
|
towire_bool(&p, true);
|
||||||
|
towire_pubkey(&p, blinding_in);
|
||||||
|
}
|
||||||
if (!reply_blinding)
|
if (!reply_blinding)
|
||||||
towire_bool(&p, false);
|
towire_bool(&p, false);
|
||||||
else {
|
else {
|
||||||
|
@ -1123,7 +1129,7 @@ u8 *towire_got_onionmsg_to_us(const tal_t *ctx, const struct pubkey *reply_blind
|
||||||
|
|
||||||
return memcheck(p, tal_count(p));
|
return memcheck(p, tal_count(p));
|
||||||
}
|
}
|
||||||
bool fromwire_got_onionmsg_to_us(const tal_t *ctx, const void *p, struct pubkey **reply_blinding, struct onionmsg_path ***reply_path)
|
bool fromwire_got_onionmsg_to_us(const tal_t *ctx, const void *p, struct pubkey **blinding_in, struct pubkey **reply_blinding, struct onionmsg_path ***reply_path)
|
||||||
{
|
{
|
||||||
u16 reply_path_len;
|
u16 reply_path_len;
|
||||||
|
|
||||||
|
@ -1132,6 +1138,12 @@ bool fromwire_got_onionmsg_to_us(const tal_t *ctx, const void *p, struct pubkey
|
||||||
|
|
||||||
if (fromwire_u16(&cursor, &plen) != WIRE_GOT_ONIONMSG_TO_US)
|
if (fromwire_u16(&cursor, &plen) != WIRE_GOT_ONIONMSG_TO_US)
|
||||||
return false;
|
return false;
|
||||||
|
if (!fromwire_bool(&cursor, &plen))
|
||||||
|
*blinding_in = NULL;
|
||||||
|
else {
|
||||||
|
*blinding_in = tal(ctx, struct pubkey);
|
||||||
|
fromwire_pubkey(&cursor, &plen, *blinding_in);
|
||||||
|
}
|
||||||
if (!fromwire_bool(&cursor, &plen))
|
if (!fromwire_bool(&cursor, &plen))
|
||||||
*reply_blinding = NULL;
|
*reply_blinding = NULL;
|
||||||
else {
|
else {
|
||||||
|
@ -1236,4 +1248,4 @@ bool fromwire_send_onionmsg(const tal_t *ctx, const void *p, u8 onion[1366], str
|
||||||
}
|
}
|
||||||
return cursor != NULL;
|
return cursor != NULL;
|
||||||
}
|
}
|
||||||
// SHA256STAMP:0ddc4d686d50049ed4c8500919e415dde43baea52adc651b8a606765b09ab001
|
// SHA256STAMP:c520ab3f9f3c5e7a7b1cdd7535bd95ee82a7b352602da56eb37d603a1890fd46
|
||||||
|
|
6
channeld/channeld_wiregen.h
generated
6
channeld/channeld_wiregen.h
generated
|
@ -232,8 +232,8 @@ bool fromwire_channeld_send_error_reply(const void *p);
|
||||||
|
|
||||||
/* WIRE: GOT_ONIONMSG_TO_US */
|
/* WIRE: GOT_ONIONMSG_TO_US */
|
||||||
/* Tell lightningd we got a onion message (for us */
|
/* Tell lightningd we got a onion message (for us */
|
||||||
u8 *towire_got_onionmsg_to_us(const tal_t *ctx, const struct pubkey *reply_blinding, const struct onionmsg_path **reply_path);
|
u8 *towire_got_onionmsg_to_us(const tal_t *ctx, const struct pubkey *blinding_in, const struct pubkey *reply_blinding, const struct onionmsg_path **reply_path);
|
||||||
bool fromwire_got_onionmsg_to_us(const tal_t *ctx, const void *p, struct pubkey **reply_blinding, struct onionmsg_path ***reply_path);
|
bool fromwire_got_onionmsg_to_us(const tal_t *ctx, const void *p, struct pubkey **blinding_in, struct pubkey **reply_blinding, struct onionmsg_path ***reply_path);
|
||||||
|
|
||||||
/* WIRE: GOT_ONIONMSG_FORWARD */
|
/* WIRE: GOT_ONIONMSG_FORWARD */
|
||||||
u8 *towire_got_onionmsg_forward(const tal_t *ctx, const struct short_channel_id *next_scid, const struct node_id *next_node_id, const struct pubkey *next_blinding, const u8 next_onion[1366]);
|
u8 *towire_got_onionmsg_forward(const tal_t *ctx, const struct short_channel_id *next_scid, const struct node_id *next_node_id, const struct pubkey *next_blinding, const u8 next_onion[1366]);
|
||||||
|
@ -246,4 +246,4 @@ bool fromwire_send_onionmsg(const tal_t *ctx, const void *p, u8 onion[1366], str
|
||||||
|
|
||||||
|
|
||||||
#endif /* LIGHTNING_CHANNELD_CHANNELD_WIREGEN_H */
|
#endif /* LIGHTNING_CHANNELD_CHANNELD_WIREGEN_H */
|
||||||
// SHA256STAMP:0ddc4d686d50049ed4c8500919e415dde43baea52adc651b8a606765b09ab001
|
// SHA256STAMP:c520ab3f9f3c5e7a7b1cdd7535bd95ee82a7b352602da56eb37d603a1890fd46
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#if EXPERIMENTAL_FEATURES
|
#if EXPERIMENTAL_FEATURES
|
||||||
struct onion_message_hook_payload {
|
struct onion_message_hook_payload {
|
||||||
/* Optional */
|
/* Optional */
|
||||||
|
struct pubkey *blinding_in;
|
||||||
struct pubkey *reply_blinding;
|
struct pubkey *reply_blinding;
|
||||||
struct onionmsg_path **reply_path;
|
struct onionmsg_path **reply_path;
|
||||||
|
|
||||||
|
@ -21,6 +22,8 @@ onion_message_serialize(struct onion_message_hook_payload *payload,
|
||||||
struct json_stream *stream)
|
struct json_stream *stream)
|
||||||
{
|
{
|
||||||
json_object_start(stream, "onion_message");
|
json_object_start(stream, "onion_message");
|
||||||
|
if (payload->blinding_in)
|
||||||
|
json_add_pubkey(stream, "blinding_in", payload->blinding_in);
|
||||||
if (payload->reply_path) {
|
if (payload->reply_path) {
|
||||||
json_array_start(stream, "reply_path");
|
json_array_start(stream, "reply_path");
|
||||||
for (size_t i = 0; i < tal_count(payload->reply_path); i++) {
|
for (size_t i = 0; i < tal_count(payload->reply_path); i++) {
|
||||||
|
@ -93,6 +96,7 @@ void handle_onionmsg_to_us(struct channel *channel, const u8 *msg)
|
||||||
payload = tal(ld, struct onion_message_hook_payload);
|
payload = tal(ld, struct onion_message_hook_payload);
|
||||||
|
|
||||||
if (!fromwire_got_onionmsg_to_us(payload, msg,
|
if (!fromwire_got_onionmsg_to_us(payload, msg,
|
||||||
|
&payload->blinding_in,
|
||||||
&payload->reply_blinding,
|
&payload->reply_blinding,
|
||||||
&payload->reply_path)) {
|
&payload->reply_path)) {
|
||||||
channel_internal_error(channel, "bad got_onionmsg_tous: %s",
|
channel_internal_error(channel, "bad got_onionmsg_tous: %s",
|
||||||
|
|
Loading…
Add table
Reference in a new issue