From cb22015b2a19e4a4f9a259df9227dbd5c199872a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 9 Sep 2021 12:20:52 +0930 Subject: [PATCH] common/channel_type: wrapper for generated 'struct channel_type'. We make it a first-class citizen internally, even though we won't use it over the wire (at least, non-experimental builds). This scheme follows the latest draft, in which features are flagged compulsory. We also add several helper functions. Since uses the *even* bits (as per latest spec), not the *odd* bits, we have some other fixups. Signed-off-by: Rusty Russell --- channeld/Makefile | 1 + channeld/channeld.c | 20 +-- channeld/channeld_wiregen.c | 2 +- channeld/channeld_wiregen.h | 2 +- channeld/test/Makefile | 1 + channeld/test/run-commit_tx.c | 17 +++ channeld/test/run-full_channel.c | 13 ++ closingd/closingd_wiregen.c | 2 +- closingd/closingd_wiregen.h | 2 +- common/Makefile | 1 + common/channel_type.c | 143 ++++++++++++++++++ common/channel_type.h | 38 +++++ common/initial_channel.c | 61 ++------ common/initial_channel.h | 6 +- common/peer_status_wiregen.c | 2 +- common/peer_status_wiregen.h | 2 +- common/status_wiregen.c | 2 +- common/status_wiregen.h | 2 +- common/test/run-bolt12_merkle-json.c | 7 + common/test/run-bolt12_merkle.c | 7 + common/test/run-gossmap_local.c | 7 + common/test/run-json.c | 7 + common/test/run-param.c | 7 + common/test/run-route-specific.c | 7 + common/test/run-route.c | 7 + connectd/connectd_gossipd_wiregen.c | 2 +- connectd/connectd_gossipd_wiregen.h | 2 +- connectd/connectd_wiregen.c | 2 +- connectd/connectd_wiregen.h | 2 +- devtools/Makefile | 3 +- devtools/mkcommit.c | 1 + gossipd/gossip_store_wiregen.c | 2 +- gossipd/gossip_store_wiregen.h | 2 +- gossipd/gossipd_peerd_wiregen.c | 2 +- gossipd/gossipd_peerd_wiregen.h | 2 +- gossipd/gossipd_wiregen.c | 2 +- gossipd/gossipd_wiregen.h | 2 +- gossipd/test/run-check_channel_announcement.c | 7 + gossipd/test/run-check_node_announcement.c | 7 + gossipd/test/run-crc32_of_update.c | 7 + gossipd/test/run-extended-info.c | 7 + gossipd/test/run-next_block_range.c | 7 + gossipd/test/run-txout_failure.c | 7 + hsmd/hsmd_wiregen.c | 2 +- hsmd/hsmd_wiregen.h | 2 +- onchaind/onchaind_wiregen.c | 2 +- onchaind/onchaind_wiregen.h | 2 +- openingd/Makefile | 1 + openingd/dualopend.c | 2 +- openingd/dualopend_wiregen.c | 2 +- openingd/dualopend_wiregen.h | 2 +- openingd/openingd.c | 2 +- openingd/openingd_wiregen.c | 2 +- openingd/openingd_wiregen.h | 2 +- plugins/Makefile | 3 +- tests/test_connection.py | 8 +- tools/generate-wire.py | 1 + wire/Makefile | 14 +- wire/bolt12_wiregen.c | 2 +- wire/bolt12_wiregen.h | 2 +- wire/channel_type_wire.csv | 4 + wire/common_wiregen.c | 2 +- wire/common_wiregen.h | 2 +- wire/extracted_peer_exp_upgradable.patch | 5 +- wire/onion_printgen.c | 2 +- wire/onion_printgen.h | 2 +- wire/onion_wiregen.c | 2 +- wire/onion_wiregen.h | 2 +- wire/peer_printgen.c | 2 +- wire/peer_printgen.h | 2 +- wire/peer_wiregen.c | 2 +- wire/peer_wiregen.h | 2 +- wire/test/run-peer-wire.c | 7 + wire/test/run-tlvstream.c | 7 + 74 files changed, 404 insertions(+), 122 deletions(-) create mode 100644 common/channel_type.c create mode 100644 common/channel_type.h create mode 100644 wire/channel_type_wire.csv diff --git a/channeld/Makefile b/channeld/Makefile index 8fb4cc12ff87..49261924a287 100644 --- a/channeld/Makefile +++ b/channeld/Makefile @@ -38,6 +38,7 @@ CHANNELD_COMMON_OBJS := \ common/blockheight_states.o \ common/channel_config.o \ common/channel_id.o \ + common/channel_type.o \ common/crypto_state.o \ common/crypto_sync.o \ common/cryptomsg.o \ diff --git a/channeld/channeld.c b/channeld/channeld.c index 67e994d78f7e..66a322fcf125 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -33,11 +33,11 @@ #include #include #include +#include #include #include #include #include -#include #include #include #include @@ -360,12 +360,6 @@ static bool handle_master_request_later(struct peer *peer, const u8 *msg) return false; } -static bool channel_type_eq(const struct channel_type *a, - const struct channel_type *b) -{ - return featurebits_eq(a->features, b->features); -} - static bool match_type(const struct channel_type *desired, const struct channel_type *current, struct channel_type **upgradable) @@ -377,18 +371,13 @@ static bool match_type(const struct channel_type *desired, if (channel_type_eq(desired, current)) return true; - for (size_t i = 0; i < tal_count(upgradable); i++) { - if (channel_type_eq(desired, upgradable[i])) - return true; - } - - return false; + return channel_type_eq_any(desired, upgradable); } static void set_channel_type(struct channel *channel, const struct channel_type *type) { - const struct channel_type *cur = channel_type(tmpctx, channel); + const struct channel_type *cur = current_channel_type(tmpctx, channel); if (channel_type_eq(cur, type)) return; @@ -2744,7 +2733,8 @@ static void peer_reconnect(struct peer *peer, * to. * - MAY not set `upgradable` if it would be empty. */ - send_tlvs->current_type = channel_type(send_tlvs, peer->channel); + send_tlvs->current_type + = current_channel_type(send_tlvs, peer->channel); send_tlvs->upgradable = channel_upgradable_types(send_tlvs, peer->channel); } diff --git a/channeld/channeld_wiregen.c b/channeld/channeld_wiregen.c index 6432965dba72..5ceb3e7500b2 100644 --- a/channeld/channeld_wiregen.c +++ b/channeld/channeld_wiregen.c @@ -1181,4 +1181,4 @@ bool fromwire_channeld_blockheight(const void *p, u32 *blockheight) *blockheight = fromwire_u32(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:6f638b484f282fdb7bd20ddaedc18092bb1f76a16d843179fb1558d569b687ab +// SHA256STAMP:61caa30da7bcc0a39b2b13a94d5c24a386a6b7a6f4c0800cb37e46e423824f61 diff --git a/channeld/channeld_wiregen.h b/channeld/channeld_wiregen.h index 9897d2454099..6af2a165c94f 100644 --- a/channeld/channeld_wiregen.h +++ b/channeld/channeld_wiregen.h @@ -240,4 +240,4 @@ bool fromwire_channeld_blockheight(const void *p, u32 *blockheight); #endif /* LIGHTNING_CHANNELD_CHANNELD_WIREGEN_H */ -// SHA256STAMP:6f638b484f282fdb7bd20ddaedc18092bb1f76a16d843179fb1558d569b687ab +// SHA256STAMP:61caa30da7bcc0a39b2b13a94d5c24a386a6b7a6f4c0800cb37e46e423824f61 diff --git a/channeld/test/Makefile b/channeld/test/Makefile index 7847f022291c..7342fad619dd 100644 --- a/channeld/test/Makefile +++ b/channeld/test/Makefile @@ -9,6 +9,7 @@ ALL_TEST_PROGRAMS += $(CHANNELD_TEST_PROGRAMS) CHANNELD_TEST_COMMON_OBJS := \ common/amount.o \ + common/channel_type.o \ common/daemon_conn.o \ common/htlc_state.o \ common/htlc_trim.o \ diff --git a/channeld/test/run-commit_tx.c b/channeld/test/run-commit_tx.c index eb167f7d27ac..3324298d9308 100644 --- a/channeld/test/run-commit_tx.c +++ b/channeld/test/run-commit_tx.c @@ -1,5 +1,6 @@ #include #include +#include #include static bool print_superverbose; #define SUPERVERBOSE(...) \ @@ -22,6 +23,19 @@ static bool print_superverbose; /*#define DEBUG */ /* AUTOGENERATED MOCKS START */ +/* Generated stub for feature_is_set */ +bool feature_is_set(const u8 *features UNNEEDED, size_t bit UNNEEDED) +{ fprintf(stderr, "feature_is_set called!\n"); abort(); } +/* Generated stub for feature_negotiated */ +bool feature_negotiated(const struct feature_set *our_features UNNEEDED, + const u8 *their_features UNNEEDED, size_t f UNNEEDED) +{ fprintf(stderr, "feature_negotiated called!\n"); abort(); } +/* Generated stub for feature_offered */ +bool feature_offered(const u8 *features UNNEEDED, size_t f UNNEEDED) +{ fprintf(stderr, "feature_offered called!\n"); abort(); } +/* Generated stub for featurebits_eq */ +bool featurebits_eq(const u8 *f1 UNNEEDED, const u8 *f2 UNNEEDED) +{ fprintf(stderr, "featurebits_eq called!\n"); abort(); } /* Generated stub for fromwire_bigsize */ bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_bigsize called!\n"); abort(); } @@ -32,6 +46,9 @@ void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, /* Generated stub for fromwire_node_id */ void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED) { fprintf(stderr, "fromwire_node_id called!\n"); abort(); } +/* Generated stub for set_feature_bit */ +void set_feature_bit(u8 **ptr UNNEEDED, u32 bit UNNEEDED) +{ fprintf(stderr, "set_feature_bit called!\n"); abort(); } /* Generated stub for status_fmt */ void status_fmt(enum log_level level UNNEEDED, const struct node_id *peer UNNEEDED, diff --git a/channeld/test/run-full_channel.c b/channeld/test/run-full_channel.c index a9cb50362fbc..24293d3ce13e 100644 --- a/channeld/test/run-full_channel.c +++ b/channeld/test/run-full_channel.c @@ -18,6 +18,19 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for feature_is_set */ +bool feature_is_set(const u8 *features UNNEEDED, size_t bit UNNEEDED) +{ fprintf(stderr, "feature_is_set called!\n"); abort(); } +/* Generated stub for feature_negotiated */ +bool feature_negotiated(const struct feature_set *our_features UNNEEDED, + const u8 *their_features UNNEEDED, size_t f UNNEEDED) +{ fprintf(stderr, "feature_negotiated called!\n"); abort(); } +/* Generated stub for feature_offered */ +bool feature_offered(const u8 *features UNNEEDED, size_t f UNNEEDED) +{ fprintf(stderr, "feature_offered called!\n"); abort(); } +/* Generated stub for featurebits_eq */ +bool featurebits_eq(const u8 *f1 UNNEEDED, const u8 *f2 UNNEEDED) +{ fprintf(stderr, "featurebits_eq called!\n"); abort(); } /* Generated stub for fromwire_bigsize */ bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) { fprintf(stderr, "fromwire_bigsize called!\n"); abort(); } diff --git a/closingd/closingd_wiregen.c b/closingd/closingd_wiregen.c index dfaebc219b19..0d70f57fb39e 100644 --- a/closingd/closingd_wiregen.c +++ b/closingd/closingd_wiregen.c @@ -209,4 +209,4 @@ bool fromwire_closingd_complete(const void *p) return false; return cursor != NULL; } -// SHA256STAMP:2de9bc103000dc6f1f821186efd51ed571b8515f6c6bd10df5067405d45cf151 +// SHA256STAMP:bda282f9c8cf3c0fc1274165b9adeb691f0447fd9c27cb4bbe0717e809df4a95 diff --git a/closingd/closingd_wiregen.h b/closingd/closingd_wiregen.h index b4b649b73053..89673a73c738 100644 --- a/closingd/closingd_wiregen.h +++ b/closingd/closingd_wiregen.h @@ -56,4 +56,4 @@ bool fromwire_closingd_complete(const void *p); #endif /* LIGHTNING_CLOSINGD_CLOSINGD_WIREGEN_H */ -// SHA256STAMP:2de9bc103000dc6f1f821186efd51ed571b8515f6c6bd10df5067405d45cf151 +// SHA256STAMP:bda282f9c8cf3c0fc1274165b9adeb691f0447fd9c27cb4bbe0717e809df4a95 diff --git a/common/Makefile b/common/Makefile index aeadc739a1d2..f0e68d2e615c 100644 --- a/common/Makefile +++ b/common/Makefile @@ -17,6 +17,7 @@ COMMON_SRC_NOGEN := \ common/bolt12_merkle.c \ common/channel_config.c \ common/channel_id.c \ + common/channel_type.c \ common/coin_mvt.c \ common/close_tx.c \ common/configdir.c \ diff --git a/common/channel_type.c b/common/channel_type.c new file mode 100644 index 000000000000..842a1631967f --- /dev/null +++ b/common/channel_type.c @@ -0,0 +1,143 @@ +#include +#include + +/* BOLT-channel-types #2: + * Channel types are an explicit enumeration: for convenience of future + * definitions they reuse even feature bits, but they are not an + * arbitrary combination (they represent the persistent features which + * affect the channel operation). + * + * The currently defined types are: + * - no features (no bits set) + * - `option_static_remotekey` (bit 12) + * - `option_anchor_outputs` and `option_static_remotekey` (bits 20 and 12) + * - `option_anchors_zero_fee_htlc_tx` and `option_static_remotekey` (bits 22 + * and 12) + */ +struct channel_type *channel_type_none(const tal_t *ctx) +{ + struct channel_type *type = tal(ctx, struct channel_type); + + type->features = tal_arr(type, u8, 0); + return type; +} + +struct channel_type *channel_type_static_remotekey(const tal_t *ctx) +{ + struct channel_type *type = channel_type_none(ctx); + + set_feature_bit(&type->features, + COMPULSORY_FEATURE(OPT_STATIC_REMOTEKEY)); + return type; +} + +struct channel_type *channel_type_anchor_outputs(const tal_t *ctx) +{ + struct channel_type *type = channel_type_none(ctx); + + set_feature_bit(&type->features, + COMPULSORY_FEATURE(OPT_ANCHOR_OUTPUTS)); + set_feature_bit(&type->features, + COMPULSORY_FEATURE(OPT_STATIC_REMOTEKEY)); + return type; +} + +struct channel_type *default_channel_type(const tal_t *ctx, + const struct feature_set *our_features, + const u8 *their_features) +{ + /* BOLT-channel-types #2: + * Both peers: + * - if `channel_type` was present in both `open_channel` and `accept_channel`: + * - This is the `channel_type` (they must be equal, required above) + * - otherwise: + */ + /* BOLT-channel-types #2: + * - otherwise, if `option_anchor_outputs` was negotiated: + * - the `channel_type` is `option_anchor_outputs` and + * `option_static_remotekey` (bits 20 and 12) + */ + if (feature_negotiated(our_features, their_features, + OPT_ANCHOR_OUTPUTS)) + return channel_type_anchor_outputs(ctx); + /* BOLT-channel-types #2: + * - otherwise, if `option_static_remotekey` was negotiated: + * - the `channel_type` is `option_static_remotekey` (bit 12) + */ + else if (feature_negotiated(our_features, their_features, + OPT_STATIC_REMOTEKEY)) + return channel_type_static_remotekey(ctx); + /* BOLT-channel-types #2: + * - otherwise: + * - the `channel_type` is empty + */ + else + return channel_type_none(ctx); +} + +bool channel_type_has(const struct channel_type *type, int feature) +{ + return feature_offered(type->features, feature); +} + +bool channel_type_eq(const struct channel_type *a, + const struct channel_type *b) +{ + return featurebits_eq(a->features, b->features); +} + +bool channel_type_eq_any(const struct channel_type *t, + struct channel_type **arr) +{ + for (size_t i = 0; i < tal_count(arr); i++) { + if (channel_type_eq(t, arr[i])) + return true; + } + return false; +} + +struct channel_type *channel_type_dup(const tal_t *ctx, + const struct channel_type *t) +{ + struct channel_type *ret = tal(ctx, struct channel_type); + ret->features = tal_dup_talarr(ret, u8, t->features); + return ret; +} + +struct channel_type *channel_type_accept(const tal_t *ctx, + const u8 *t, + const struct feature_set *our_features, + const u8 *their_features) +{ + struct channel_type *ctype; + static const size_t feats[] = { OPT_ANCHOR_OUTPUTS, + OPT_STATIC_REMOTEKEY }; + + for (size_t i = 0; i < ARRAY_SIZE(feats); i++) { + size_t f = feats[i]; + + if (feature_offered(t, f)) { + /* If we don't offer a feature, we don't allow it. */ + if (!feature_offered(our_features->bits[INIT_FEATURE], f)) + return NULL; + } else { + /* We assume that if we *require* a feature, we require + * channels have that. */ + if (feature_is_set(our_features->bits[INIT_FEATURE], + COMPULSORY_FEATURE(f))) + return NULL; + } + } + + /* Otherwise, just needs to be a known channel type. */ + ctype = channel_type_none(tmpctx); + if (featurebits_eq(t, ctype->features)) + return tal_steal(ctx, ctype); + ctype = channel_type_static_remotekey(tmpctx); + if (featurebits_eq(t, ctype->features)) + return tal_steal(ctx, ctype); + ctype = channel_type_anchor_outputs(tmpctx); + if (featurebits_eq(t, ctype->features)) + return tal_steal(ctx, ctype); + return NULL; +} diff --git a/common/channel_type.h b/common/channel_type.h new file mode 100644 index 000000000000..e34ee52bfd5d --- /dev/null +++ b/common/channel_type.h @@ -0,0 +1,38 @@ +/* This represents a channel type: i.e. the sticky feature bits. */ +#ifndef LIGHTNING_COMMON_CHANNEL_TYPE_H +#define LIGHTNING_COMMON_CHANNEL_TYPE_H +#include "config.h" +#include +#include + +/* Explicit channel types */ +struct channel_type *channel_type_none(const tal_t *ctx); +struct channel_type *channel_type_static_remotekey(const tal_t *ctx); +struct channel_type *channel_type_anchor_outputs(const tal_t *ctx); + +/* Duplicate a channel_type */ +struct channel_type *channel_type_dup(const tal_t *ctx, + const struct channel_type *t); + +/* Derive channel type from feature negotiation */ +struct channel_type *default_channel_type(const tal_t *ctx, + const struct feature_set *our_features, + const u8 *their_features); + +/* Does this type include this feature? */ +bool channel_type_has(const struct channel_type *type, int feature); + +/* Are these two channel_types equivalent? */ +bool channel_type_eq(const struct channel_type *a, + const struct channel_type *b); + +/* Is channel_type_eq() for any type in this array? */ +bool channel_type_eq_any(const struct channel_type *t, + struct channel_type **arr); + +/* Return channel_type if this is acceptable, otherwise NULL */ +struct channel_type *channel_type_accept(const tal_t *ctx, + const u8 *t, + const struct feature_set *our_features, + const u8 *their_features); +#endif /* LIGHTNING_COMMON_CHANNEL_TYPE_H */ diff --git a/common/initial_channel.c b/common/initial_channel.c index 19e6291cbd5e..56599c5ec5e6 100644 --- a/common/initial_channel.c +++ b/common/initial_channel.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -169,53 +169,15 @@ u32 channel_blockheight(const struct channel *channel, enum side side) channel->opener, side); } -#if EXPERIMENTAL_FEATURES -/* BOLT-upgrade_protocol #2: - * Channel features are explicitly enumerated as `channel_type` bitfields, - * using odd features bits. The currently defined types are: - * - no features (no bits set) - * - `option_static_remotekey` (bit 13) - * - `option_anchor_outputs` and `option_static_remotekey` (bits 21 and 13) - * - `option_anchors_zero_fee_htlc_tx` and `option_static_remotekey` (bits 23 - * and 13) - */ -static struct channel_type *new_channel_type(const tal_t *ctx) +struct channel_type *current_channel_type(const tal_t *ctx, + const struct channel *channel) { - struct channel_type *type = tal(ctx, struct channel_type); + if (channel->option_anchor_outputs) + return channel_type_anchor_outputs(ctx); + if (channel->option_static_remotekey) + return channel_type_static_remotekey(ctx); - type->features = tal_arr(type, u8, 0); - return type; -} - -static struct channel_type *type_static_remotekey(const tal_t *ctx) -{ - struct channel_type *type = new_channel_type(ctx); - - set_feature_bit(&type->features, - OPTIONAL_FEATURE(OPT_STATIC_REMOTEKEY)); - return type; -} - -static struct channel_type *type_anchor_outputs(const tal_t *ctx) -{ - struct channel_type *type = new_channel_type(ctx); - - set_feature_bit(&type->features, - OPTIONAL_FEATURE(OPT_ANCHOR_OUTPUTS)); - set_feature_bit(&type->features, - OPTIONAL_FEATURE(OPT_STATIC_REMOTEKEY)); - return type; -} - -struct channel_type *channel_type(const tal_t *ctx, - const struct channel *channel) -{ - if (channel->option_anchor_outputs) - return type_anchor_outputs(ctx); - if (channel->option_static_remotekey) - return type_static_remotekey(ctx); - - return new_channel_type(ctx); + return channel_type_none(ctx); } struct channel_type **channel_upgradable_types(const tal_t *ctx, @@ -224,7 +186,7 @@ struct channel_type **channel_upgradable_types(const tal_t *ctx, struct channel_type **arr = tal_arr(ctx, struct channel_type *, 0); if (!channel->option_static_remotekey) - tal_arr_expand(&arr, type_static_remotekey(arr)); + tal_arr_expand(&arr, channel_type_static_remotekey(arr)); return arr; } @@ -234,12 +196,11 @@ struct channel_type *channel_desired_type(const tal_t *ctx, { /* We don't actually want to downgrade anchors! */ if (channel->option_anchor_outputs) - return type_anchor_outputs(ctx); + return channel_type_anchor_outputs(ctx); /* For now, we just want option_static_remotekey */ - return type_static_remotekey(ctx); + return channel_type_static_remotekey(ctx); } -#endif /* EXPERIMENTAL_FEATURES */ static char *fmt_channel_view(const tal_t *ctx, const struct channel_view *view) { diff --git a/common/initial_channel.h b/common/initial_channel.h index dde829e68c23..fcafbb2b5ab6 100644 --- a/common/initial_channel.h +++ b/common/initial_channel.h @@ -163,13 +163,12 @@ u32 channel_feerate(const struct channel *channel, enum side side); */ u32 channel_blockheight(const struct channel *channel, enum side side); -#if EXPERIMENTAL_FEATURES /* BOLT-upgrade_protocol #2: * Channel features are explicitly enumerated as `channel_type` bitfields, * using odd features bits. */ -struct channel_type *channel_type(const tal_t *ctx, - const struct channel *channel); +struct channel_type *current_channel_type(const tal_t *ctx, + const struct channel *channel); /* What features can we upgrade? (Returns NULL if none). */ struct channel_type **channel_upgradable_types(const tal_t *ctx, @@ -178,6 +177,5 @@ struct channel_type **channel_upgradable_types(const tal_t *ctx, /* What features do we want? */ struct channel_type *channel_desired_type(const tal_t *ctx, const struct channel *channel); -#endif /* EXPERIMENTAL_FEATURES */ #endif /* LIGHTNING_COMMON_INITIAL_CHANNEL_H */ diff --git a/common/peer_status_wiregen.c b/common/peer_status_wiregen.c index b2464ea361f2..b8684f24197b 100644 --- a/common/peer_status_wiregen.c +++ b/common/peer_status_wiregen.c @@ -80,4 +80,4 @@ bool fromwire_status_peer_error(const tal_t *ctx, const void *p, struct channel_ fromwire_u8_array(&cursor, &plen, *error_for_them, len); return cursor != NULL; } -// SHA256STAMP:53c75737dd0b8df4245093d3236d2d494451f01872e30b2ad76853766f22c60e +// SHA256STAMP:b3244d3c5f959de2b906e7afc98c3278282ab06eab89c7572c424b36b994c484 diff --git a/common/peer_status_wiregen.h b/common/peer_status_wiregen.h index 414e9a487c5e..350d65876689 100644 --- a/common/peer_status_wiregen.h +++ b/common/peer_status_wiregen.h @@ -34,4 +34,4 @@ bool fromwire_status_peer_error(const tal_t *ctx, const void *p, struct channel_ #endif /* LIGHTNING_COMMON_PEER_STATUS_WIREGEN_H */ -// SHA256STAMP:53c75737dd0b8df4245093d3236d2d494451f01872e30b2ad76853766f22c60e +// SHA256STAMP:b3244d3c5f959de2b906e7afc98c3278282ab06eab89c7572c424b36b994c484 diff --git a/common/status_wiregen.c b/common/status_wiregen.c index 6301460966dc..53be92d4dd03 100644 --- a/common/status_wiregen.c +++ b/common/status_wiregen.c @@ -214,4 +214,4 @@ bool fromwire_status_version(const tal_t *ctx, const void *p, wirestring **versi *version = fromwire_wirestring(ctx, &cursor, &plen); return cursor != NULL; } -// SHA256STAMP:efb87b0bb9ae86931d808d17b03d3e7a9b4c4f2577f152f04fbe4531a6b8196a +// SHA256STAMP:9ccc7c9a9c09390733ffde17bcee096fef4b4edbf469a5037574fe8eefe6f946 diff --git a/common/status_wiregen.h b/common/status_wiregen.h index 76435311f0bf..7eb0e8276f59 100644 --- a/common/status_wiregen.h +++ b/common/status_wiregen.h @@ -58,4 +58,4 @@ bool fromwire_status_version(const tal_t *ctx, const void *p, wirestring **versi #endif /* LIGHTNING_COMMON_STATUS_WIREGEN_H */ -// SHA256STAMP:efb87b0bb9ae86931d808d17b03d3e7a9b4c4f2577f152f04fbe4531a6b8196a +// SHA256STAMP:9ccc7c9a9c09390733ffde17bcee096fef4b4edbf469a5037574fe8eefe6f946 diff --git a/common/test/run-bolt12_merkle-json.c b/common/test/run-bolt12_merkle-json.c index e3181fb83e61..e567f9592a4f 100644 --- a/common/test/run-bolt12_merkle-json.c +++ b/common/test/run-bolt12_merkle-json.c @@ -18,6 +18,7 @@ #include #include #include +#include #include /* AUTOGENERATED MOCKS START */ @@ -25,6 +26,9 @@ void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "fromwire_channel_id called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for fromwire_node_id */ void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED) { fprintf(stderr, "fromwire_node_id called!\n"); abort(); } @@ -50,6 +54,9 @@ void towire_bool(u8 **pptr UNNEEDED, bool v UNNEEDED) /* Generated stub for towire_channel_id */ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "towire_channel_id called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for towire_node_id */ void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) { fprintf(stderr, "towire_node_id called!\n"); abort(); } diff --git a/common/test/run-bolt12_merkle.c b/common/test/run-bolt12_merkle.c index db6baae7b5f8..7d04e12e1c99 100644 --- a/common/test/run-bolt12_merkle.c +++ b/common/test/run-bolt12_merkle.c @@ -10,6 +10,7 @@ #include #include #include +#include /* Definition of n1 from the spec */ #include @@ -24,12 +25,18 @@ int features_unsupported(const struct feature_set *our_features UNNEEDED, void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "fromwire_channel_id called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for fromwire_onionmsg_path */ struct onionmsg_path *fromwire_onionmsg_path(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) { fprintf(stderr, "fromwire_onionmsg_path called!\n"); abort(); } /* Generated stub for towire_channel_id */ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "towire_channel_id called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for towire_onionmsg_path */ void towire_onionmsg_path(u8 **p UNNEEDED, const struct onionmsg_path *onionmsg_path UNNEEDED) { fprintf(stderr, "towire_onionmsg_path called!\n"); abort(); } diff --git a/common/test/run-gossmap_local.c b/common/test/run-gossmap_local.c index fecfcbd8041f..31a191c15efa 100644 --- a/common/test/run-gossmap_local.c +++ b/common/test/run-gossmap_local.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -19,12 +20,18 @@ bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "fromwire_channel_id called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for towire_bigsize */ void towire_bigsize(u8 **pptr UNNEEDED, const bigsize_t val UNNEEDED) { fprintf(stderr, "towire_bigsize called!\n"); abort(); } /* Generated stub for towire_channel_id */ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "towire_channel_id called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for type_to_string_ */ const char *type_to_string_(const tal_t *ctx UNNEEDED, const char *typename UNNEEDED, union printable_types u UNNEEDED) diff --git a/common/test/run-json.c b/common/test/run-json.c index f14a66b53825..96f0796237da 100644 --- a/common/test/run-json.c +++ b/common/test/run-json.c @@ -7,9 +7,13 @@ #include #include #include +#include #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for fromwire_tlv */ bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED, @@ -19,6 +23,9 @@ bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, bool tlv_fields_valid(const struct tlv_field *fields UNNEEDED, u64 *allow_extra UNNEEDED, size_t *err_index UNNEEDED) { fprintf(stderr, "tlv_fields_valid called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for towire_tlv */ void towire_tlv(u8 **pptr UNNEEDED, const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED, diff --git a/common/test/run-param.c b/common/test/run-param.c index b4a577c9a3cc..b2d486a6c5d9 100644 --- a/common/test/run-param.c +++ b/common/test/run-param.c @@ -10,6 +10,7 @@ #include #include #include +#include #include char *fail_msg = NULL; @@ -40,6 +41,9 @@ struct command_result *command_fail(struct command *cmd, } /* AUTOGENERATED MOCKS START */ +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for fromwire_tlv */ bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED, @@ -86,6 +90,9 @@ int segwit_addr_decode( bool tlv_fields_valid(const struct tlv_field *fields UNNEEDED, u64 *allow_extra UNNEEDED, size_t *err_index UNNEEDED) { fprintf(stderr, "tlv_fields_valid called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for towire_tlv */ void towire_tlv(u8 **pptr UNNEEDED, const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED, diff --git a/common/test/run-route-specific.c b/common/test/run-route-specific.c index d2c402388590..6998ca1ab13b 100644 --- a/common/test/run-route-specific.c +++ b/common/test/run-route-specific.c @@ -6,6 +6,7 @@ * {'channels': [{'active': True, 'short_id': '6990x2x1/1', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'last_update': 1504064344}, {'active': True, 'short_id': '6989x2x1/0', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 0, 'destination': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, {'active': True, 'short_id': '6990x2x1/0', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 0, 'destination': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, {'active': True, 'short_id': '6989x2x1/1', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'last_update': 1504064344}]} */ #include +#include #include #include #include @@ -24,6 +25,9 @@ bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "fromwire_channel_id called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for fromwire_tlv */ bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED, @@ -39,6 +43,9 @@ void towire_bigsize(u8 **pptr UNNEEDED, const bigsize_t val UNNEEDED) /* Generated stub for towire_channel_id */ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "towire_channel_id called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for towire_tlv */ void towire_tlv(u8 **pptr UNNEEDED, const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED, diff --git a/common/test/run-route.c b/common/test/run-route.c index d2a08700d6d6..fb9d756a4542 100644 --- a/common/test/run-route.c +++ b/common/test/run-route.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -17,6 +18,9 @@ bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "fromwire_channel_id called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for fromwire_tlv */ bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED, @@ -32,6 +36,9 @@ void towire_bigsize(u8 **pptr UNNEEDED, const bigsize_t val UNNEEDED) /* Generated stub for towire_channel_id */ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "towire_channel_id called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for towire_tlv */ void towire_tlv(u8 **pptr UNNEEDED, const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED, diff --git a/connectd/connectd_gossipd_wiregen.c b/connectd/connectd_gossipd_wiregen.c index 7ef89e8ef1d2..0b2ab644fd15 100644 --- a/connectd/connectd_gossipd_wiregen.c +++ b/connectd/connectd_gossipd_wiregen.c @@ -161,4 +161,4 @@ bool fromwire_gossipd_get_addrs_reply(const tal_t *ctx, const void *p, struct wi fromwire_wireaddr(&cursor, &plen, *addrs + i); return cursor != NULL; } -// SHA256STAMP:1b54c6c417d2023c3c8816a56a79a80ce84305454caa42c4f3fa0d8e6bc511a7 +// SHA256STAMP:6dce0976ccde7d8461a17a5b87e00a6f6cd0256d26d29843ff15d7be82161316 diff --git a/connectd/connectd_gossipd_wiregen.h b/connectd/connectd_gossipd_wiregen.h index 0a99b441b8e9..53598f5eb8b3 100644 --- a/connectd/connectd_gossipd_wiregen.h +++ b/connectd/connectd_gossipd_wiregen.h @@ -54,4 +54,4 @@ bool fromwire_gossipd_get_addrs_reply(const tal_t *ctx, const void *p, struct wi #endif /* LIGHTNING_CONNECTD_CONNECTD_GOSSIPD_WIREGEN_H */ -// SHA256STAMP:1b54c6c417d2023c3c8816a56a79a80ce84305454caa42c4f3fa0d8e6bc511a7 +// SHA256STAMP:6dce0976ccde7d8461a17a5b87e00a6f6cd0256d26d29843ff15d7be82161316 diff --git a/connectd/connectd_wiregen.c b/connectd/connectd_wiregen.c index 9c092712f163..918216919a0d 100644 --- a/connectd/connectd_wiregen.c +++ b/connectd/connectd_wiregen.c @@ -443,4 +443,4 @@ bool fromwire_connectd_dev_memleak_reply(const void *p, bool *leak) *leak = fromwire_bool(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:477fff39e2b2b97fd4da86933f7cedd6f38097634ae4123ede66594907c414e3 +// SHA256STAMP:89a554e6550ee7c67c1526475e03fa2862335159ec5ff3e7c511da5c040e71a7 diff --git a/connectd/connectd_wiregen.h b/connectd/connectd_wiregen.h index 7648218caadb..373ab44e20bd 100644 --- a/connectd/connectd_wiregen.h +++ b/connectd/connectd_wiregen.h @@ -110,4 +110,4 @@ bool fromwire_connectd_dev_memleak_reply(const void *p, bool *leak); #endif /* LIGHTNING_CONNECTD_CONNECTD_WIREGEN_H */ -// SHA256STAMP:477fff39e2b2b97fd4da86933f7cedd6f38097634ae4123ede66594907c414e3 +// SHA256STAMP:89a554e6550ee7c67c1526475e03fa2862335159ec5ff3e7c511da5c040e71a7 diff --git a/devtools/Makefile b/devtools/Makefile index 76ef117bdbab..1cd72ceea824 100644 --- a/devtools/Makefile +++ b/devtools/Makefile @@ -43,6 +43,7 @@ DEVTOOLS_COMMON_OBJS := \ common/wireaddr.o \ wire/onion$(EXP)_wiregen.o \ wire/peer$(EXP)_wiregen.o \ + wire/channel_type_wiregen.o \ wire/tlvstream.o devtools/bolt11-cli: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/bolt11-cli.o @@ -70,7 +71,7 @@ devtools/gossipwith: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN $(DEVTOOLS_OBJS) $(DEVTOOLS_TOOL_OBJS): wire/wire.h -devtools/mkcommit: $(DEVTOOLS_COMMON_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) common/derive_basepoints.o common/keyset.o common/key_derive.o common/initial_commit_tx.o common/permute_tx.o wire/fromwire.o wire/towire.o devtools/mkcommit.o channeld/full_channel.o common/initial_channel.o common/htlc_state.o common/pseudorand.o common/htlc_tx.o channeld/commit_tx.o common/htlc_trim.o +devtools/mkcommit: $(DEVTOOLS_COMMON_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) common/derive_basepoints.o common/channel_type.o common/keyset.o common/key_derive.o common/initial_commit_tx.o common/permute_tx.o wire/fromwire.o wire/towire.o devtools/mkcommit.o channeld/full_channel.o common/initial_channel.o common/htlc_state.o common/pseudorand.o common/htlc_tx.o channeld/commit_tx.o common/htlc_trim.o devtools/mkfunding: $(DEVTOOLS_COMMON_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o common/key_derive.o devtools/mkfunding.o diff --git a/devtools/mkcommit.c b/devtools/mkcommit.c index b0f26b5707cd..eaba9608033c 100644 --- a/devtools/mkcommit.c +++ b/devtools/mkcommit.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/gossipd/gossip_store_wiregen.c b/gossipd/gossip_store_wiregen.c index 665df43b66ea..f583f5766c29 100644 --- a/gossipd/gossip_store_wiregen.c +++ b/gossipd/gossip_store_wiregen.c @@ -210,4 +210,4 @@ bool fromwire_gossipd_local_add_channel_obs(const tal_t *ctx, const void *p, str fromwire_u8_array(&cursor, &plen, *features, flen); return cursor != NULL; } -// SHA256STAMP:349d7e48ef1b41ce203a634053cbd5c9f290443e408bfa53aa7e67aaa28969d9 +// SHA256STAMP:795023c4916bb16e65d205888cbafe856143146585086230087a7c96350cafb8 diff --git a/gossipd/gossip_store_wiregen.h b/gossipd/gossip_store_wiregen.h index d75f4a107cc1..9b6679c5e96f 100644 --- a/gossipd/gossip_store_wiregen.h +++ b/gossipd/gossip_store_wiregen.h @@ -63,4 +63,4 @@ bool fromwire_gossipd_local_add_channel_obs(const tal_t *ctx, const void *p, str #endif /* LIGHTNING_GOSSIPD_GOSSIP_STORE_WIREGEN_H */ -// SHA256STAMP:349d7e48ef1b41ce203a634053cbd5c9f290443e408bfa53aa7e67aaa28969d9 +// SHA256STAMP:795023c4916bb16e65d205888cbafe856143146585086230087a7c96350cafb8 diff --git a/gossipd/gossipd_peerd_wiregen.c b/gossipd/gossipd_peerd_wiregen.c index ba59d64b5c18..3b50025beeb3 100644 --- a/gossipd/gossipd_peerd_wiregen.c +++ b/gossipd/gossipd_peerd_wiregen.c @@ -161,4 +161,4 @@ bool fromwire_gossipd_local_channel_announcement(const tal_t *ctx, const void *p fromwire_u8_array(&cursor, &plen, *cannount, len); return cursor != NULL; } -// SHA256STAMP:600189f0a17aa520601e8df4723cb0b90a9d3fe1f7a5aa59b1b7d7e23aa6c252 +// SHA256STAMP:f3c8b8c99b8a6d1e0337375ea2e252024b99bc8e88d86a91387f0886b7cfffff diff --git a/gossipd/gossipd_peerd_wiregen.h b/gossipd/gossipd_peerd_wiregen.h index cd7bf5ce8b17..755c2fbba6ce 100644 --- a/gossipd/gossipd_peerd_wiregen.h +++ b/gossipd/gossipd_peerd_wiregen.h @@ -57,4 +57,4 @@ bool fromwire_gossipd_local_channel_announcement(const tal_t *ctx, const void *p #endif /* LIGHTNING_GOSSIPD_GOSSIPD_PEERD_WIREGEN_H */ -// SHA256STAMP:600189f0a17aa520601e8df4723cb0b90a9d3fe1f7a5aa59b1b7d7e23aa6c252 +// SHA256STAMP:f3c8b8c99b8a6d1e0337375ea2e252024b99bc8e88d86a91387f0886b7cfffff diff --git a/gossipd/gossipd_wiregen.c b/gossipd/gossipd_wiregen.c index 7f75e7508bce..a4119704cc99 100644 --- a/gossipd/gossipd_wiregen.c +++ b/gossipd/gossipd_wiregen.c @@ -777,4 +777,4 @@ bool fromwire_gossipd_new_lease_rates(const void *p, struct lease_rates *rates) fromwire_lease_rates(&cursor, &plen, rates); return cursor != NULL; } -// SHA256STAMP:3f85ead064706c1a9cf60622838cf886ec92eb91c18360ac1aee7faeadd1a3cd +// SHA256STAMP:14767c196ce9ab6b891ea20a5f620a5fcb94f67ffc23d757a04222cc8012e1af diff --git a/gossipd/gossipd_wiregen.h b/gossipd/gossipd_wiregen.h index 7fb85b90bcf2..01e1c00def3b 100644 --- a/gossipd/gossipd_wiregen.h +++ b/gossipd/gossipd_wiregen.h @@ -188,4 +188,4 @@ bool fromwire_gossipd_new_lease_rates(const void *p, struct lease_rates *rates); #endif /* LIGHTNING_GOSSIPD_GOSSIPD_WIREGEN_H */ -// SHA256STAMP:3f85ead064706c1a9cf60622838cf886ec92eb91c18360ac1aee7faeadd1a3cd +// SHA256STAMP:14767c196ce9ab6b891ea20a5f620a5fcb94f67ffc23d757a04222cc8012e1af diff --git a/gossipd/test/run-check_channel_announcement.c b/gossipd/test/run-check_channel_announcement.c index 411ae4c604ce..58e489332b79 100644 --- a/gossipd/test/run-check_channel_announcement.c +++ b/gossipd/test/run-check_channel_announcement.c @@ -29,6 +29,7 @@ In particular, we set feature bit 19. The spec says we should set feature bit 1 #include "../common/wire_error.c" #include "../routing.c" +#include #include #include #include @@ -42,6 +43,9 @@ bool cupdate_different(struct gossip_store *gs UNNEEDED, /* Generated stub for fmt_wireaddr_without_port */ char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED) { fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for fromwire_wireaddr_array */ struct wireaddr *fromwire_wireaddr_array(const tal_t *ctx UNNEEDED, const u8 *ser UNNEEDED) { fprintf(stderr, "fromwire_wireaddr_array called!\n"); abort(); } @@ -124,6 +128,9 @@ void status_fmt(enum log_level level UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "status_fmt called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, char *argv[]) diff --git a/gossipd/test/run-check_node_announcement.c b/gossipd/test/run-check_node_announcement.c index 5017ce3d14c2..995ff193f50a 100644 --- a/gossipd/test/run-check_node_announcement.c +++ b/gossipd/test/run-check_node_announcement.c @@ -2,6 +2,7 @@ #include #include #include +#include /* AUTOGENERATED MOCKS START */ /* Generated stub for find_peer */ @@ -10,6 +11,9 @@ struct peer *find_peer(struct daemon *daemon UNNEEDED, const struct node_id *id /* Generated stub for fmt_wireaddr_without_port */ char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED) { fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for fromwire_gossipd_local_channel_update */ bool fromwire_gossipd_local_channel_update(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, bool *disable UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, struct amount_msat *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED, struct amount_msat *htlc_maximum_msat UNNEEDED) { fprintf(stderr, "fromwire_gossipd_local_channel_update called!\n"); abort(); } @@ -74,6 +78,9 @@ void status_fmt(enum log_level level UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "status_fmt called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for towire_hsmd_cupdate_sig_req */ u8 *towire_hsmd_cupdate_sig_req(const tal_t *ctx UNNEEDED, const u8 *cu UNNEEDED) { fprintf(stderr, "towire_hsmd_cupdate_sig_req called!\n"); abort(); } diff --git a/gossipd/test/run-crc32_of_update.c b/gossipd/test/run-crc32_of_update.c index 239354883a6e..2f51c910ca0c 100644 --- a/gossipd/test/run-crc32_of_update.c +++ b/gossipd/test/run-crc32_of_update.c @@ -3,6 +3,7 @@ int unused_main(int argc, char *argv[]); #include "../queries.c" #include "../gossip_generation.c" #undef main +#include #include #include @@ -31,6 +32,9 @@ struct peer *find_peer(struct daemon *daemon UNNEEDED, const struct node_id *id /* Generated stub for fmt_wireaddr_without_port */ char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED) { fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for fromwire_gossipd_dev_set_max_scids_encode_size */ bool fromwire_gossipd_dev_set_max_scids_encode_size(const void *p UNNEEDED, u32 *max UNNEEDED) { fprintf(stderr, "fromwire_gossipd_dev_set_max_scids_encode_size called!\n"); abort(); } @@ -113,6 +117,9 @@ void status_fmt(enum log_level level UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "status_fmt called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for towire_hsmd_cupdate_sig_req */ u8 *towire_hsmd_cupdate_sig_req(const tal_t *ctx UNNEEDED, const u8 *cu UNNEEDED) { fprintf(stderr, "towire_hsmd_cupdate_sig_req called!\n"); abort(); } diff --git a/gossipd/test/run-extended-info.c b/gossipd/test/run-extended-info.c index 4400e2b44c80..3cba5011380f 100644 --- a/gossipd/test/run-extended-info.c +++ b/gossipd/test/run-extended-info.c @@ -4,6 +4,7 @@ #include "../queries.c" #include +#include #include #include #include @@ -36,6 +37,9 @@ struct short_channel_id *decode_short_ids(const tal_t *ctx UNNEEDED, const u8 *e /* Generated stub for fmt_wireaddr_without_port */ char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED) { fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for fromwire_gossipd_dev_set_max_scids_encode_size */ bool fromwire_gossipd_dev_set_max_scids_encode_size(const void *p UNNEEDED, u32 *max UNNEEDED) { fprintf(stderr, "fromwire_gossipd_dev_set_max_scids_encode_size called!\n"); abort(); } @@ -82,6 +86,9 @@ void queue_peer_from_store(struct peer *peer UNNEEDED, /* Generated stub for queue_peer_msg */ void queue_peer_msg(struct peer *peer UNNEEDED, const u8 *msg TAKES UNNEEDED) { fprintf(stderr, "queue_peer_msg called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for towire_warningfmt */ u8 *towire_warningfmt(const tal_t *ctx UNNEEDED, const struct channel_id *channel UNNEEDED, diff --git a/gossipd/test/run-next_block_range.c b/gossipd/test/run-next_block_range.c index 246dfe4ef55b..b8a7bdaa364d 100644 --- a/gossipd/test/run-next_block_range.c +++ b/gossipd/test/run-next_block_range.c @@ -1,5 +1,6 @@ #include "../seeker.c" #include +#include #include #include #include @@ -10,6 +11,9 @@ /* Generated stub for fmt_wireaddr_without_port */ char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED) { fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for json_add_member */ void json_add_member(struct json_stream *js UNNEEDED, const char *fieldname UNNEEDED, @@ -68,6 +72,9 @@ void status_fmt(enum log_level level UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "status_fmt called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for would_ratelimit_cupdate */ bool would_ratelimit_cupdate(struct routing_state *rstate UNNEEDED, const struct half_chan *hc UNNEEDED, diff --git a/gossipd/test/run-txout_failure.c b/gossipd/test/run-txout_failure.c index bc811554a80d..a196f90f85bc 100644 --- a/gossipd/test/run-txout_failure.c +++ b/gossipd/test/run-txout_failure.c @@ -1,5 +1,6 @@ #include "../routing.c" #include "../common/timeout.c" +#include #include #include #include @@ -13,6 +14,9 @@ bool cupdate_different(struct gossip_store *gs UNNEEDED, /* Generated stub for fmt_wireaddr_without_port */ char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED) { fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for fromwire_wireaddr_array */ struct wireaddr *fromwire_wireaddr_array(const tal_t *ctx UNNEEDED, const u8 *ser UNNEEDED) { fprintf(stderr, "fromwire_wireaddr_array called!\n"); abort(); } @@ -89,6 +93,9 @@ void status_fmt(enum log_level level UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "status_fmt called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* Generated stub for towire_warningfmt */ u8 *towire_warningfmt(const tal_t *ctx UNNEEDED, const struct channel_id *channel UNNEEDED, diff --git a/hsmd/hsmd_wiregen.c b/hsmd/hsmd_wiregen.c index ee8d1b45c7a3..aa43d9b1369f 100644 --- a/hsmd/hsmd_wiregen.c +++ b/hsmd/hsmd_wiregen.c @@ -1331,4 +1331,4 @@ bool fromwire_hsmd_sign_option_will_fund_offer_reply(const void *p, secp256k1_ec fromwire_secp256k1_ecdsa_signature(&cursor, &plen, rsig); return cursor != NULL; } -// SHA256STAMP:3a1cfc8bae7f0755d3463502a70a24105d57d69b8713a919b384ed2d5dbf0cd3 +// SHA256STAMP:5ad9bd055256f1ef74c90f07b1a7afce00922aef9780fb948eecbed409f288a7 diff --git a/hsmd/hsmd_wiregen.h b/hsmd/hsmd_wiregen.h index 90079f27ad9e..b55c47793fc5 100644 --- a/hsmd/hsmd_wiregen.h +++ b/hsmd/hsmd_wiregen.h @@ -295,4 +295,4 @@ bool fromwire_hsmd_sign_option_will_fund_offer_reply(const void *p, secp256k1_ec #endif /* LIGHTNING_HSMD_HSMD_WIREGEN_H */ -// SHA256STAMP:3a1cfc8bae7f0755d3463502a70a24105d57d69b8713a919b384ed2d5dbf0cd3 +// SHA256STAMP:5ad9bd055256f1ef74c90f07b1a7afce00922aef9780fb948eecbed409f288a7 diff --git a/onchaind/onchaind_wiregen.c b/onchaind/onchaind_wiregen.c index f390407e0101..8e7054165bea 100644 --- a/onchaind/onchaind_wiregen.c +++ b/onchaind/onchaind_wiregen.c @@ -639,4 +639,4 @@ bool fromwire_onchaind_notify_coin_mvt(const void *p, struct chain_coin_mvt *mvt fromwire_chain_coin_mvt(&cursor, &plen, mvt); return cursor != NULL; } -// SHA256STAMP:f591fbdc03a41071e5db7a11ee0420f52a1edf1fdd282d32aca0dadca9ef58e9 +// SHA256STAMP:20dc7be2811008cab3f7d2ddafb6c8496c9e8fcf91d00cb770c2f4b7f2038ff6 diff --git a/onchaind/onchaind_wiregen.h b/onchaind/onchaind_wiregen.h index 0151742d99bb..f342c69c45f6 100644 --- a/onchaind/onchaind_wiregen.h +++ b/onchaind/onchaind_wiregen.h @@ -161,4 +161,4 @@ bool fromwire_onchaind_notify_coin_mvt(const void *p, struct chain_coin_mvt *mvt #endif /* LIGHTNING_ONCHAIND_ONCHAIND_WIREGEN_H */ -// SHA256STAMP:f591fbdc03a41071e5db7a11ee0420f52a1edf1fdd282d32aca0dadca9ef58e9 +// SHA256STAMP:20dc7be2811008cab3f7d2ddafb6c8496c9e8fcf91d00cb770c2f4b7f2038ff6 diff --git a/openingd/Makefile b/openingd/Makefile index 655119611f5c..e0d77e6122a2 100644 --- a/openingd/Makefile +++ b/openingd/Makefile @@ -39,6 +39,7 @@ OPENINGD_COMMON_OBJS := \ common/blockheight_states.o \ common/channel_config.o \ common/channel_id.o \ + common/channel_type.o \ common/crypto_state.o \ common/crypto_sync.o \ common/cryptomsg.o \ diff --git a/openingd/dualopend.c b/openingd/dualopend.c index 342eacbd862b..14f0f38ce084 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -27,8 +27,8 @@ #include #include #include +#include #include -#include #include #include #include diff --git a/openingd/dualopend_wiregen.c b/openingd/dualopend_wiregen.c index 5526d2b3c9dc..aeec43288766 100644 --- a/openingd/dualopend_wiregen.c +++ b/openingd/dualopend_wiregen.c @@ -1051,4 +1051,4 @@ bool fromwire_dualopend_validate_lease_reply(const tal_t *ctx, const void *p, wi } return cursor != NULL; } -// SHA256STAMP:d3e4c74b3be230886c645147161d1886b771aa740286dd96957c83dc07aaf3ee +// SHA256STAMP:c698a54fc29460937c0acb7747670f756df42d10b6cb2fe1d3676dd9c045eb4b diff --git a/openingd/dualopend_wiregen.h b/openingd/dualopend_wiregen.h index f52b30eb65af..f821460f34be 100644 --- a/openingd/dualopend_wiregen.h +++ b/openingd/dualopend_wiregen.h @@ -225,4 +225,4 @@ bool fromwire_dualopend_validate_lease_reply(const tal_t *ctx, const void *p, wi #endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */ -// SHA256STAMP:d3e4c74b3be230886c645147161d1886b771aa740286dd96957c83dc07aaf3ee +// SHA256STAMP:c698a54fc29460937c0acb7747670f756df42d10b6cb2fe1d3676dd9c045eb4b diff --git a/openingd/openingd.c b/openingd/openingd.c index c60ab94e2d8a..9c686ed94532 100644 --- a/openingd/openingd.c +++ b/openingd/openingd.c @@ -18,9 +18,9 @@ #include #include #include +#include #include #include -#include #include #include #include diff --git a/openingd/openingd_wiregen.c b/openingd/openingd_wiregen.c index 5c2f1fddc25f..c077956985ce 100644 --- a/openingd/openingd_wiregen.c +++ b/openingd/openingd_wiregen.c @@ -600,4 +600,4 @@ bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak) *leak = fromwire_bool(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:f3d812d3286e301c6ef426e582de63b3c140e4e156a64df5ea31e1849ed3902d +// SHA256STAMP:5af57506d50a0146a11775226d2f4a265ab1d689eabda9a2244ae87013330034 diff --git a/openingd/openingd_wiregen.h b/openingd/openingd_wiregen.h index 834fd86e4653..fdf8a314fce0 100644 --- a/openingd/openingd_wiregen.h +++ b/openingd/openingd_wiregen.h @@ -128,4 +128,4 @@ bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak); #endif /* LIGHTNING_OPENINGD_OPENINGD_WIREGEN_H */ -// SHA256STAMP:f3d812d3286e301c6ef426e582de63b3c140e4e156a64df5ea31e1849ed3902d +// SHA256STAMP:5af57506d50a0146a11775226d2f4a265ab1d689eabda9a2244ae87013330034 diff --git a/plugins/Makefile b/plugins/Makefile index f9ec59a4045b..b54c0fcea75c 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -133,6 +133,7 @@ PLUGIN_COMMON_OBJS := \ common/utils.o \ common/version.o \ common/wireaddr.o \ + wire/channel_type_wiregen.o \ wire/fromwire.o \ wire/onion$(EXP)_wiregen.o \ wire/peer$(EXP)_wiregen.o \ @@ -146,7 +147,7 @@ plugins/autoclean: bitcoin/chainparams.o $(PLUGIN_AUTOCLEAN_OBJS) $(PLUGIN_LIB_O # Topology wants to decode node_announcement, and peer_wiregen which # pulls in some of bitcoin/. -plugins/topology: common/route.o common/dijkstra.o common/gossmap.o common/fp16.o bitcoin/chainparams.o wire/peer$(EXP)_wiregen.o bitcoin/block.o bitcoin/preimage.o $(PLUGIN_TOPOLOGY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) +plugins/topology: common/route.o common/dijkstra.o common/gossmap.o common/fp16.o bitcoin/chainparams.o wire/peer$(EXP)_wiregen.o wire/channel_type_wiregen.o bitcoin/block.o bitcoin/preimage.o $(PLUGIN_TOPOLOGY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) plugins/txprepare: bitcoin/chainparams.o $(PLUGIN_TXPREPARE_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) diff --git a/tests/test_connection.py b/tests/test_connection.py index a3ba2fd379d5..2082b49f4bd4 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -3500,8 +3500,8 @@ def test_upgrade_statickey(node_factory, executor): l1.rpc.connect(l2.info['id'], 'localhost', l2.port) l1.daemon.wait_for_logs([r"They sent current_type \[\]", - r"They offered upgrade to \[13\]"]) - l2.daemon.wait_for_log(r"They sent desired_type \[13\]") + r"They offered upgrade to \[12\]"]) + l2.daemon.wait_for_log(r"They sent desired_type \[12\]") l1.daemon.wait_for_log('option_static_remotekey enabled at 1/1') l2.daemon.wait_for_log('option_static_remotekey enabled at 1/1') @@ -3514,8 +3514,8 @@ def test_upgrade_statickey(node_factory, executor): # They won't offer upgrade! assert not l1.daemon.is_in_log("They offered upgrade", start=l1.daemon.logsearch_start) - l1.daemon.wait_for_log(r"They sent current_type \[13\]") - l2.daemon.wait_for_log(r"They sent desired_type \[13\]") + l1.daemon.wait_for_log(r"They sent current_type \[12\]") + l2.daemon.wait_for_log(r"They sent desired_type \[12\]") @unittest.skipIf(not EXPERIMENTAL_FEATURES, "upgrade protocol not available") diff --git a/tools/generate-wire.py b/tools/generate-wire.py index 9845c9a0bfce..33a601d5126c 100755 --- a/tools/generate-wire.py +++ b/tools/generate-wire.py @@ -239,6 +239,7 @@ class Type(FieldSet): 'tx_parts', 'wally_psbt', 'wally_tx', + 'channel_type', ] # Some BOLT types are re-typed based on their field name diff --git a/wire/Makefile b/wire/Makefile index b822b97401a2..345fa83263db 100644 --- a/wire/Makefile +++ b/wire/Makefile @@ -11,6 +11,7 @@ WIRE_HEADERS := wire/onion_defs.h \ wire/onion$(EXP)_wiregen.h \ wire/bolt12$(EXP)_wiregen.h \ wire/common_wiregen.h \ + wire/channel_type_wiregen.h \ wire/peer$(EXP)_printgen.h \ wire/onion$(EXP)_printgen.h @@ -24,11 +25,13 @@ WIRE_SRC := wire/wire_sync.c \ wire/common_wiregen.c \ wire/bolt12$(EXP)_wiregen.c \ wire/peer$(EXP)_wiregen.c \ + wire/channel_type_wiregen.c \ wire/onion$(EXP)_wiregen.c WIRE_PRINT_SRC := \ wire/onion$(EXP)_printgen.c \ - wire/peer$(EXP)_printgen.c + wire/peer$(EXP)_printgen.c \ + wire/channel_type_printgen.c WIRE_OBJS := $(WIRE_SRC:.c=.o) WIRE_PRINT_OBJS := $(WIRE_PRINT_SRC:.c=.o) @@ -45,7 +48,8 @@ WIRE_NONEXP_HEADERS := wire/peer_wiregen.h \ wire/onion_wiregen.h \ wire/bolt12_wiregen.h \ wire/peer_printgen.h \ - wire/onion_printgen.h + wire/onion_printgen.h \ + wire/channel_type_printgen.h ALL_C_SOURCES += $(WIRE_SRC) $(WIRE_PRINT_SRC) $(WIRE_NONEXP_SRC) @@ -125,8 +129,9 @@ wire/onion_wiregen.h_args := --include='bitcoin/short_channel_id.h' --include='b wire/onion_wiregen.c_args := -s --expose-tlv-type=tlv_payload # Same for _exp versions -wire/peer_exp_wiregen.h_args := $(wire/peer_wiregen.h_args) +wire/peer_exp_wiregen.h_args := $(wire/peer_wiregen.h_args) --include='wire/channel_type_wiregen.h' wire/peer_exp_wiregen.c_args := $(wire/peer_wiregen.c_args) +wire/peer_exp_printgen.h_args := --include='wire/channel_type_printgen.h' wire/onion_exp_wiregen.h_args := $(wire/onion_wiregen.h_args) wire/onion_exp_wiregen.c_args := $(wire/onion_wiregen.c_args) @@ -138,6 +143,9 @@ wire/bolt12_exp_wiregen.c_args := $(wire/bolt12_wiregen.c_args) wire/peer_wiregen.h_args := --include='common/channel_id.h' --include='bitcoin/tx.h' --include='bitcoin/preimage.h' --include='bitcoin/short_channel_id.h' --include='common/node_id.h' --include='common/bigsize.h' --include='bitcoin/block.h' --include='bitcoin/privkey.h' -s --expose-tlv-type=n1 --expose-tlv-type=n2 +wire/channel_type_wiregen.h_args := -s +wire/channel_type_wiregen.c_args := $(wire/channel_type_wiregen.h_args) + # All generated wire/ files depend on this Makefile $(filter %printgen.h %printgen.c %wiregen.h %wiregen.c, $(WIRE_SRC) $(WIRE_PRINT_SRC) $(WIRE_NONEXP_SRC) $(WIRE_HEADERS) $(WIRE_NONEXP_HEADERS)): wire/Makefile diff --git a/wire/bolt12_wiregen.c b/wire/bolt12_wiregen.c index a5b11528be20..3f40802acfa7 100644 --- a/wire/bolt12_wiregen.c +++ b/wire/bolt12_wiregen.c @@ -1684,4 +1684,4 @@ bool invoice_error_is_valid(const struct tlv_invoice_error *record, size_t *err_ return tlv_fields_valid(record->fields, NULL, err_index); } -// SHA256STAMP:53c38e8f9d5938a10c80fffa22d9093be51728cf59d3ef13ec477c848e9d48d1 +// SHA256STAMP:d6c9a7b168be00b6c823052f1c62bf4fec8792ca81bc9125173af0bd357885f4 diff --git a/wire/bolt12_wiregen.h b/wire/bolt12_wiregen.h index 6b35316be818..196514dbf053 100644 --- a/wire/bolt12_wiregen.h +++ b/wire/bolt12_wiregen.h @@ -323,4 +323,4 @@ struct fallback_address *fromwire_fallback_address(const tal_t *ctx, const u8 ** #endif /* LIGHTNING_WIRE_BOLT12_WIREGEN_H */ -// SHA256STAMP:53c38e8f9d5938a10c80fffa22d9093be51728cf59d3ef13ec477c848e9d48d1 +// SHA256STAMP:d6c9a7b168be00b6c823052f1c62bf4fec8792ca81bc9125173af0bd357885f4 diff --git a/wire/channel_type_wire.csv b/wire/channel_type_wire.csv new file mode 100644 index 000000000000..ac072f0c0fbd --- /dev/null +++ b/wire/channel_type_wire.csv @@ -0,0 +1,4 @@ +# Why not let our generator generate this too? +subtype,channel_type +subtypedata,channel_type,len,u16, +subtypedata,channel_type,features,byte,len diff --git a/wire/common_wiregen.c b/wire/common_wiregen.c index 7739b83dff50..828123f471f5 100644 --- a/wire/common_wiregen.c +++ b/wire/common_wiregen.c @@ -100,4 +100,4 @@ bool fromwire_custommsg_out(const tal_t *ctx, const void *p, u8 **msg) fromwire_u8_array(&cursor, &plen, *msg, msg_len); return cursor != NULL; } -// SHA256STAMP:0f582c50fa133054209e1f89e22ae78f969ada0d08ce162c63700051a6a25a9e +// SHA256STAMP:402f88d03a71eaf310e65fcd62fd87becf788a30626ed96c8eab3da538717a60 diff --git a/wire/common_wiregen.h b/wire/common_wiregen.h index 267efe52a19d..39baddbb2922 100644 --- a/wire/common_wiregen.h +++ b/wire/common_wiregen.h @@ -41,4 +41,4 @@ bool fromwire_custommsg_out(const tal_t *ctx, const void *p, u8 **msg); #endif /* LIGHTNING_WIRE_COMMON_WIREGEN_H */ -// SHA256STAMP:0f582c50fa133054209e1f89e22ae78f969ada0d08ce162c63700051a6a25a9e +// SHA256STAMP:402f88d03a71eaf310e65fcd62fd87becf788a30626ed96c8eab3da538717a60 diff --git a/wire/extracted_peer_exp_upgradable.patch b/wire/extracted_peer_exp_upgradable.patch index db26af74680e..2f85d96acde3 100644 --- a/wire/extracted_peer_exp_upgradable.patch +++ b/wire/extracted_peer_exp_upgradable.patch @@ -1,6 +1,6 @@ --- wire/peer_wire.csv 2021-05-09 15:44:59.166135652 +0930 +++ wire/peer_wire.csv.raw 2021-05-11 09:59:31.695459756 +0930 -@@ -221,6 +131,18 @@ +@@ -221,6 +131,15 @@ msgdata,channel_reestablish,next_revocation_number,u64, msgdata,channel_reestablish,your_last_per_commitment_secret,byte,32 msgdata,channel_reestablish,my_current_per_commitment_point,point, @@ -13,9 +13,6 @@ +tlvdata,channel_reestablish_tlvs,current_type,type,channel_type, +tlvtype,channel_reestablish_tlvs,upgradable,7 +tlvdata,channel_reestablish_tlvs,upgradable,upgrades,channel_type,... -+subtype,channel_type -+subtypedata,channel_type,len,u16, -+subtypedata,channel_type,features,byte,len msgtype,announcement_signatures,259 msgdata,announcement_signatures,channel_id,channel_id, msgdata,announcement_signatures,short_channel_id,short_channel_id, diff --git a/wire/onion_printgen.c b/wire/onion_printgen.c index 23ce0d9d6e45..2ee526c71e30 100644 --- a/wire/onion_printgen.c +++ b/wire/onion_printgen.c @@ -859,4 +859,4 @@ void printonion_wire_tlv_message(const char *tlv_name, const u8 *msg) { printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_encmsg_tlvs, ARRAY_SIZE(print_tlvs_encmsg_tlvs)); } } -// SHA256STAMP:a2a9a3075de158a886d768a148ca3dde70956188f7be6cc141cce25211cf1258 +// SHA256STAMP:09dc1e023332a80d6e5b948472d121823404a3d7bfc843142b00ead7892148a1 diff --git a/wire/onion_printgen.h b/wire/onion_printgen.h index e4c13d318226..807236a2abcb 100644 --- a/wire/onion_printgen.h +++ b/wire/onion_printgen.h @@ -58,4 +58,4 @@ void printwire_mpp_timeout(const char *fieldname, const u8 *cursor); void printwire_onionmsg_path(const char *fieldname, const u8 **cursor, size_t *plen); #endif /* LIGHTNING_WIRE_ONION_PRINTGEN_H */ -// SHA256STAMP:a2a9a3075de158a886d768a148ca3dde70956188f7be6cc141cce25211cf1258 +// SHA256STAMP:09dc1e023332a80d6e5b948472d121823404a3d7bfc843142b00ead7892148a1 diff --git a/wire/onion_wiregen.c b/wire/onion_wiregen.c index 01d8acb1de47..6f0d3f4437b8 100644 --- a/wire/onion_wiregen.c +++ b/wire/onion_wiregen.c @@ -1026,4 +1026,4 @@ bool fromwire_mpp_timeout(const void *p) return false; return cursor != NULL; } -// SHA256STAMP:a2a9a3075de158a886d768a148ca3dde70956188f7be6cc141cce25211cf1258 +// SHA256STAMP:09dc1e023332a80d6e5b948472d121823404a3d7bfc843142b00ead7892148a1 diff --git a/wire/onion_wiregen.h b/wire/onion_wiregen.h index 82353e35901e..7a548eced28a 100644 --- a/wire/onion_wiregen.h +++ b/wire/onion_wiregen.h @@ -317,4 +317,4 @@ bool fromwire_mpp_timeout(const void *p); #endif /* LIGHTNING_WIRE_ONION_WIREGEN_H */ -// SHA256STAMP:a2a9a3075de158a886d768a148ca3dde70956188f7be6cc141cce25211cf1258 +// SHA256STAMP:09dc1e023332a80d6e5b948472d121823404a3d7bfc843142b00ead7892148a1 diff --git a/wire/peer_printgen.c b/wire/peer_printgen.c index 6ddcc1a40003..7567cbaffe74 100644 --- a/wire/peer_printgen.c +++ b/wire/peer_printgen.c @@ -3139,4 +3139,4 @@ void printpeer_wire_tlv_message(const char *tlv_name, const u8 *msg) { printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_onion_message_tlvs, ARRAY_SIZE(print_tlvs_onion_message_tlvs)); } } -// SHA256STAMP:bf392c19e6fd1e87040d84d0de259dcec0fa52b4d78e613629ef049e373e1d78 +// SHA256STAMP:594dbd4e700334431fccd0dc7bd7ef22ca033299d24ba92f920601a807291c64 diff --git a/wire/peer_printgen.h b/wire/peer_printgen.h index e80c089e4393..87df04cdd09d 100644 --- a/wire/peer_printgen.h +++ b/wire/peer_printgen.h @@ -99,4 +99,4 @@ void printwire_channel_update_checksums(const char *fieldname, const u8 **cursor void printwire_channel_update_timestamps(const char *fieldname, const u8 **cursor, size_t *plen); void printwire_witness_stack(const char *fieldname, const u8 **cursor, size_t *plen); #endif /* LIGHTNING_WIRE_PEER_PRINTGEN_H */ -// SHA256STAMP:bf392c19e6fd1e87040d84d0de259dcec0fa52b4d78e613629ef049e373e1d78 +// SHA256STAMP:594dbd4e700334431fccd0dc7bd7ef22ca033299d24ba92f920601a807291c64 diff --git a/wire/peer_wiregen.c b/wire/peer_wiregen.c index 8a909a642179..c90eaa78b690 100644 --- a/wire/peer_wiregen.c +++ b/wire/peer_wiregen.c @@ -2589,4 +2589,4 @@ bool fromwire_channel_update_option_channel_htlc_max(const void *p, secp256k1_ec *htlc_maximum_msat = fromwire_amount_msat(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:bf392c19e6fd1e87040d84d0de259dcec0fa52b4d78e613629ef049e373e1d78 +// SHA256STAMP:594dbd4e700334431fccd0dc7bd7ef22ca033299d24ba92f920601a807291c64 diff --git a/wire/peer_wiregen.h b/wire/peer_wiregen.h index fce222ce7ebe..6704f262bbd8 100644 --- a/wire/peer_wiregen.h +++ b/wire/peer_wiregen.h @@ -981,4 +981,4 @@ bool fromwire_channel_update_option_channel_htlc_max(const void *p, secp256k1_ec #endif /* LIGHTNING_WIRE_PEER_WIREGEN_H */ -// SHA256STAMP:bf392c19e6fd1e87040d84d0de259dcec0fa52b4d78e613629ef049e373e1d78 +// SHA256STAMP:594dbd4e700334431fccd0dc7bd7ef22ca033299d24ba92f920601a807291c64 diff --git a/wire/test/run-peer-wire.c b/wire/test/run-peer-wire.c index 4c74c3314491..b624df16102a 100644 --- a/wire/test/run-peer-wire.c +++ b/wire/test/run-peer-wire.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -21,6 +22,12 @@ extern secp256k1_context *secp256k1_ctx; /* AUTOGENERATED MOCKS START */ +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ /* memsetting pubkeys doesn't work */ diff --git a/wire/test/run-tlvstream.c b/wire/test/run-tlvstream.c index 6821f3d5beb9..2cf00405bcba 100644 --- a/wire/test/run-tlvstream.c +++ b/wire/test/run-tlvstream.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -28,9 +29,15 @@ static const char *reason; void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "fromwire_channel_id called!\n"); abort(); } +/* Generated stub for fromwire_channel_type */ +struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) +{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); } /* Generated stub for towire_channel_id */ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED) { fprintf(stderr, "towire_channel_id called!\n"); abort(); } +/* Generated stub for towire_channel_type */ +void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED) +{ fprintf(stderr, "towire_channel_type called!\n"); abort(); } /* AUTOGENERATED MOCKS END */