Browse Source

EXPERMENTAL_FEATURES: Import onion message types.

This tracks https://github.com/lightningnetwork/lightning-rfc/pull/759

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
parent
commit
f76ab93df6
  1. 4
      channeld/channeld.c
  2. 3
      gossipd/gossipd.c
  3. 2
      tools/check-spelling.sh
  4. 28
      wire/extracted_onion_experimental_1b1c9a71038bd72453cabefd3ace17ce8b8dd96e
  5. 11
      wire/extracted_peer_experimental_1b1c9a71038bd72453cabefd3ace17ce8b8dd96e
  6. 6
      wire/peer_wire.c
  7. 14
      wire/wire.h

4
channeld/channeld.c

@ -1692,6 +1692,10 @@ static void peer_in(struct peer *peer, const u8 *msg)
case WIRE_SHUTDOWN:
handle_peer_shutdown(peer, msg);
return;
#if EXPERIMENTAL_FEATURES
case WIRE_ONION_MESSAGE:
break;
#endif
case WIRE_INIT:
case WIRE_OPEN_CHANNEL:

3
gossipd/gossipd.c

@ -488,6 +488,9 @@ static struct io_plan *peer_msg_in(struct io_conn *conn,
case WIRE_CHANNEL_REESTABLISH:
case WIRE_ANNOUNCEMENT_SIGNATURES:
case WIRE_GOSSIP_TIMESTAMP_FILTER:
#if EXPERIMENTAL_FEATURES
case WIRE_ONION_MESSAGE:
#endif
status_broken("peer %s: relayed unexpected msg of type %s",
type_to_string(tmpctx, struct node_id, &peer->id),
wire_type_name(fromwire_peektype(msg)));

2
tools/check-spelling.sh

@ -6,7 +6,7 @@ if git --no-pager grep -nHiE 'l[ightn]{6}g|l[ightn]{8}g|ilghtning|lgihtning|lihg
exit 1
fi
if git --no-pager grep -nHiE 'ctlv' -- . ':!tools/check-spelling.sh'; then
if git --no-pager grep -nHiE 'ctlv' | grep -v 'enctlv' -- . ':!tools/check-spelling.sh'; then
echo "It's check lock time verify, not check time lock verify!" >&2
exit 1
fi

28
wire/extracted_onion_experimental_1b1c9a71038bd72453cabefd3ace17ce8b8dd96e

@ -0,0 +1,28 @@
--- wire/extracted_onion_wire_csv 2020-03-25 10:24:12.861645774 +1030
+++ - 2020-03-26 13:47:13.498294435 +1030
@@ -8,6 +8,25 @@
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,enctlv,10
+tlvdata,onionmsg_payload,enctlv,enctlv,byte,...
+tlvtype,onionmsg_payload,blinding,12
+tlvdata,onionmsg_payload,blinding,blinding,point,
+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,
+subtype,onionmsg_path
+subtypedata,onionmsg_path,node_id,point,
+subtypedata,onionmsg_path,enclen,u16,
+subtypedata,onionmsg_path,enctlv,byte,enclen
msgtype,invalid_realm,PERM|1
msgtype,temporary_node_failure,NODE|2
msgtype,permanent_node_failure,PERM|NODE|2

11
wire/extracted_peer_experimental_1b1c9a71038bd72453cabefd3ace17ce8b8dd96e

@ -0,0 +1,11 @@
--- wire/extracted_peer_wire_csv 2020-03-11 10:30:35.744376417 +1030
+++ - 2020-03-26 13:47:13.409755567 +1030
@@ -211,3 +211,8 @@
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,onionmsg,byte,1366
+msgdata,onion_message,onion_message_tlvs,onion_message_tlvs,
+tlvtype,onion_message_tlvs,blinding,2
+tlvdata,onion_message_tlvs,blinding,blinding,point,

6
wire/peer_wire.c

@ -31,6 +31,9 @@ static bool unknown_type(enum wire_type t)
case WIRE_QUERY_CHANNEL_RANGE:
case WIRE_REPLY_CHANNEL_RANGE:
case WIRE_GOSSIP_TIMESTAMP_FILTER:
#if EXPERIMENTAL_FEATURES
case WIRE_ONION_MESSAGE:
#endif
return false;
}
return true;
@ -68,6 +71,9 @@ bool is_msg_for_gossipd(const u8 *cursor)
case WIRE_CHANNEL_REESTABLISH:
case WIRE_ANNOUNCEMENT_SIGNATURES:
case WIRE_GOSSIP_TIMESTAMP_FILTER:
#if EXPERIMENTAL_FEATURES
case WIRE_ONION_MESSAGE:
#endif
break;
}
return false;

14
wire/wire.h

@ -153,4 +153,18 @@ struct witscript *fromwire_witscript(const tal_t *ctx,
void fromwire_chainparams(const u8 **cursor, size_t *max,
const struct chainparams **chainparams);
#if !EXPERIMENTAL_FEATURES
/* Stubs, as this subtype is only defined when EXPERIMENTAL_FEATURES */
struct onionmsg_path;
static inline void towire_onionmsg_path(u8 **p, const struct onionmsg_path *onionmsg_path)
{
}
static inline struct onionmsg_path *
fromwire_onionmsg_path(const tal_t *ctx, const u8 **cursor, size_t *plen)
{
return NULL;
}
#endif /* EXPERIMENTAL_FEATURES */
#endif /* LIGHTNING_WIRE_WIRE_H */

Loading…
Cancel
Save