From d5d4e7b0195b8a6ad2e1065f605b2c2990fc0c0d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 23 Jul 2022 16:24:19 +0930 Subject: [PATCH] common/features: add channel_type definition, neaten header. Put all the normal spec-defined ones together. Signed-off-by: Rusty Russell --- common/features.c | 7 ++++++- common/features.h | 36 +++++++++++++++++------------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/common/features.c b/common/features.c index 5040c39ac..f14b298f9 100644 --- a/common/features.c +++ b/common/features.c @@ -125,6 +125,11 @@ static const struct feature_style feature_styles[] = { * we refuse to parse it. */ [BOLT11_FEATURE] = FEATURE_REPRESENT, [CHANNEL_FEATURE] = FEATURE_DONT_REPRESENT } }, + { OPT_CHANNEL_TYPE, + .copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT, + [NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT, + [BOLT11_FEATURE] = FEATURE_DONT_REPRESENT, + [CHANNEL_FEATURE] = FEATURE_DONT_REPRESENT } }, }; struct dependency { @@ -441,7 +446,7 @@ const char *feature_name(const tal_t *ctx, size_t f) "option_onion_messages", /* https://github.com/lightningnetwork/lightning-rfc/pull/759 */ "option_want_peer_backup", /* 40/41 */ /* https://github.com/lightningnetwork/lightning-rfc/pull/881 */ "option_provide_peer_backup", /* https://github.com/lightningnetwork/lightning-rfc/pull/881 */ - NULL, + "option_channel_type", "option_scid_alias", /* https://github.com/lightning/bolts/pull/910 */ "option_payment_metadata", "option_zeroconf", /* 50/51, https://github.com/lightning/bolts/pull/910 */ diff --git a/common/features.h b/common/features.h index d5da02fdf..ccb914020 100644 --- a/common/features.h +++ b/common/features.h @@ -99,14 +99,22 @@ struct feature_set *feature_set_dup(const tal_t *ctx, /* BOLT #9: * - * | Bits | Name |... - * | 0/1 | `option_data_loss_protect` |... - * | 3 | `initial_routing_sync` |... - * | 4/5 | `option_upfront_shutdown_script` |... - * | 6/7 | `gossip_queries` |... - * | 8/9 | `var_onion_optin` |... - * | 10/11 | `gossip_queries_ex` |... - * | 12/13 | `option_static_remotekey` |... + * | Bits | Name |... + * | 0/1 | `option_data_loss_protect` |... IN ... + * | 3 | `initial_routing_sync` |... I ... + * | 4/5 | `option_upfront_shutdown_script` |... IN ... + * | 6/7 | `gossip_queries` |... IN ... + * | 8/9 | `var_onion_optin` |... IN9 ... + * | 10/11 | `gossip_queries_ex` |... IN ... + * | 12/13 | `option_static_remotekey` |... IN ... + * | 14/15 | `payment_secret` |... IN9 ... + * | 16/17 | `basic_mpp` |... IN9 ... + * | 18/19 | `option_support_large_channel` |... IN ... + * | 20/21 | `option_anchor_outputs` |... IN ... + * | 22/23 | `option_anchors_zero_fee_htlc_tx` |... IN ... + * | 26/27 | `option_shutdown_anysegwit` |... IN ... + * | 44/45 | `option_channel_type` |... IN ... + * | 48/49 | `option_payment_metadata` |... 9 ... */ #define OPT_DATA_LOSS_PROTECT 0 #define OPT_INITIAL_ROUTING_SYNC 2 @@ -115,23 +123,13 @@ struct feature_set *feature_set_dup(const tal_t *ctx, #define OPT_VAR_ONION 8 #define OPT_GOSSIP_QUERIES_EX 10 #define OPT_STATIC_REMOTEKEY 12 - -/* BOLT #9: - * - * | 14/15 | `payment_secret` |... IN9 ... - * | 16/17 | `basic_mpp` |... IN9 ... - * | 18/19 | `option_support_large_channel` |... IN ... - * | 20/21 | `option_anchor_outputs` |... IN ... - * | 22/23 | `option_anchors_zero_fee_htlc_tx` |... IN ... - * | 26/27 | `option_shutdown_anysegwit` |... IN ... - * | 48/49 | `option_payment_metadata` |... 9 ... - */ #define OPT_PAYMENT_SECRET 14 #define OPT_BASIC_MPP 16 #define OPT_LARGE_CHANNELS 18 #define OPT_ANCHOR_OUTPUTS 20 #define OPT_ANCHORS_ZERO_FEE_HTLC_TX 22 #define OPT_SHUTDOWN_ANYSEGWIT 26 +#define OPT_CHANNEL_TYPE 44 #define OPT_PAYMENT_METADATA 48 /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #9: