diff --git a/channeld/channeld_wiregen.c b/channeld/channeld_wiregen.c index 7a3f1b9ac..080d29117 100644 --- a/channeld/channeld_wiregen.c +++ b/channeld/channeld_wiregen.c @@ -1248,4 +1248,4 @@ bool fromwire_send_onionmsg(const tal_t *ctx, const void *p, u8 onion[1366], str } return cursor != NULL; } -// SHA256STAMP:a33294db19a7303fee551c13179ad7d4b00acdefe081ce9a0d9806f4e44176fe +// SHA256STAMP:d9bd64dc170dd8cbc8329c2ae59bd251d7057f948f7ef527b8e769cfe267e937 diff --git a/channeld/channeld_wiregen.h b/channeld/channeld_wiregen.h index 693d31812..4bea149b3 100644 --- a/channeld/channeld_wiregen.h +++ b/channeld/channeld_wiregen.h @@ -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 */ -// SHA256STAMP:a33294db19a7303fee551c13179ad7d4b00acdefe081ce9a0d9806f4e44176fe +// SHA256STAMP:d9bd64dc170dd8cbc8329c2ae59bd251d7057f948f7ef527b8e769cfe267e937 diff --git a/closingd/closingd_wiregen.c b/closingd/closingd_wiregen.c index 78084500c..0ca1081ab 100644 --- a/closingd/closingd_wiregen.c +++ b/closingd/closingd_wiregen.c @@ -201,4 +201,4 @@ bool fromwire_closingd_complete(const void *p) return false; return cursor != NULL; } -// SHA256STAMP:90bf34ec2ea0eea83908d5a5be93757fd5967d797258c358a60b4d7f2eff3801 +// SHA256STAMP:e0edc6ae34e0b58fbc2f33b2a388ca55a4821422fcfafee098dc19b5e480b3d5 diff --git a/closingd/closingd_wiregen.h b/closingd/closingd_wiregen.h index ec5107c95..96036e079 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:90bf34ec2ea0eea83908d5a5be93757fd5967d797258c358a60b4d7f2eff3801 +// SHA256STAMP:e0edc6ae34e0b58fbc2f33b2a388ca55a4821422fcfafee098dc19b5e480b3d5 diff --git a/common/peer_status_wiregen.c b/common/peer_status_wiregen.c index 4a45a99f6..666fa196f 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:ffe5ce4130de4968d0f46ba1dd28cfb4260caba13c9699c572dc3c192291fa60 +// SHA256STAMP:612d608c07fc296757d24389b7a459a3f9b72285fafe342a5c8cd42fd3ec88af diff --git a/common/peer_status_wiregen.h b/common/peer_status_wiregen.h index e43ca9877..465d1adbb 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:ffe5ce4130de4968d0f46ba1dd28cfb4260caba13c9699c572dc3c192291fa60 +// SHA256STAMP:612d608c07fc296757d24389b7a459a3f9b72285fafe342a5c8cd42fd3ec88af diff --git a/common/status_wiregen.c b/common/status_wiregen.c index 7d9dea8ed..adf0a8f1e 100644 --- a/common/status_wiregen.c +++ b/common/status_wiregen.c @@ -191,4 +191,4 @@ bool fromwire_status_peer_billboard(const tal_t *ctx, const void *p, bool *perm, *happenings = fromwire_wirestring(ctx, &cursor, &plen); return cursor != NULL; } -// SHA256STAMP:3d02340d94ac275095ca7839fed86b3da622aca2551e39a334a8c25c562a0ef7 +// SHA256STAMP:022530b0ae77beecb3645526079c8727101593bd2a5881ecf556c9538c135d98 diff --git a/common/status_wiregen.h b/common/status_wiregen.h index a30404afc..6b8fd9fed 100644 --- a/common/status_wiregen.h +++ b/common/status_wiregen.h @@ -53,4 +53,4 @@ bool fromwire_status_peer_billboard(const tal_t *ctx, const void *p, bool *perm, #endif /* LIGHTNING_COMMON_STATUS_WIREGEN_H */ -// SHA256STAMP:3d02340d94ac275095ca7839fed86b3da622aca2551e39a334a8c25c562a0ef7 +// SHA256STAMP:022530b0ae77beecb3645526079c8727101593bd2a5881ecf556c9538c135d98 diff --git a/connectd/connectd_gossipd_wiregen.c b/connectd/connectd_gossipd_wiregen.c index 0e476152f..b7de02e50 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:1eaf731ef4b4233dc782d407020adf0d7c2729d9a7f80bcb83c69cb7a3d4555f +// SHA256STAMP:6d306e062eb24755e6585d52f4a06e9a74af50ac14e03546aaf2d8ed0c9242b5 diff --git a/connectd/connectd_gossipd_wiregen.h b/connectd/connectd_gossipd_wiregen.h index 23b6fe30c..726dee410 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:1eaf731ef4b4233dc782d407020adf0d7c2729d9a7f80bcb83c69cb7a3d4555f +// SHA256STAMP:6d306e062eb24755e6585d52f4a06e9a74af50ac14e03546aaf2d8ed0c9242b5 diff --git a/connectd/connectd_wiregen.c b/connectd/connectd_wiregen.c index 37715ec8a..55ab74ac9 100644 --- a/connectd/connectd_wiregen.c +++ b/connectd/connectd_wiregen.c @@ -406,4 +406,4 @@ bool fromwire_connectd_dev_memleak_reply(const void *p, bool *leak) *leak = fromwire_bool(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:28a1014a8d84df52f1ca48befe0a9af817dba4788e3bfd642e94e218583bcfce +// SHA256STAMP:3874bf7cdd0e406217e6e59e43fab1e287f61e1e027009e352646c24baab0568 diff --git a/connectd/connectd_wiregen.h b/connectd/connectd_wiregen.h index 081f5902f..1db95a1ed 100644 --- a/connectd/connectd_wiregen.h +++ b/connectd/connectd_wiregen.h @@ -103,4 +103,4 @@ bool fromwire_connectd_dev_memleak_reply(const void *p, bool *leak); #endif /* LIGHTNING_CONNECTD_CONNECTD_WIREGEN_H */ -// SHA256STAMP:28a1014a8d84df52f1ca48befe0a9af817dba4788e3bfd642e94e218583bcfce +// SHA256STAMP:3874bf7cdd0e406217e6e59e43fab1e287f61e1e027009e352646c24baab0568 diff --git a/gossipd/gossip_store_wiregen.c b/gossipd/gossip_store_wiregen.c index 010128ede..4782ad1ef 100644 --- a/gossipd/gossip_store_wiregen.c +++ b/gossipd/gossip_store_wiregen.c @@ -187,4 +187,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:ef3ea23ab28e4c27ad11e843929e17a304f58886570438d34f3fe9822af36dc9 +// SHA256STAMP:6e03c4b93e8b0a2c6fd61f3bd0d23bf4898dd38d109c5a401ba05e9e4e68267e diff --git a/gossipd/gossip_store_wiregen.h b/gossipd/gossip_store_wiregen.h index 339be0cb2..6496104c9 100644 --- a/gossipd/gossip_store_wiregen.h +++ b/gossipd/gossip_store_wiregen.h @@ -58,4 +58,4 @@ bool fromwire_gossipd_local_add_channel_obs(const tal_t *ctx, const void *p, str #endif /* LIGHTNING_GOSSIPD_GOSSIP_STORE_WIREGEN_H */ -// SHA256STAMP:ef3ea23ab28e4c27ad11e843929e17a304f58886570438d34f3fe9822af36dc9 +// SHA256STAMP:6e03c4b93e8b0a2c6fd61f3bd0d23bf4898dd38d109c5a401ba05e9e4e68267e diff --git a/gossipd/gossipd_peerd_wiregen.c b/gossipd/gossipd_peerd_wiregen.c index a04e7a4f0..4acb1d9d6 100644 --- a/gossipd/gossipd_peerd_wiregen.c +++ b/gossipd/gossipd_peerd_wiregen.c @@ -187,4 +187,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:467e6e1c97a006551a6ddd32fa4625f075628a268d689cbf65e2556b1e0781b7 +// SHA256STAMP:18c1c9ce4dfed92c5fc6809cf716bf31cbb39fb8db124d43ead013088aff8b7c diff --git a/gossipd/gossipd_peerd_wiregen.h b/gossipd/gossipd_peerd_wiregen.h index f7c385481..d7d70a467 100644 --- a/gossipd/gossipd_peerd_wiregen.h +++ b/gossipd/gossipd_peerd_wiregen.h @@ -64,4 +64,4 @@ bool fromwire_gossipd_local_channel_announcement(const tal_t *ctx, const void *p #endif /* LIGHTNING_GOSSIPD_GOSSIPD_PEERD_WIREGEN_H */ -// SHA256STAMP:467e6e1c97a006551a6ddd32fa4625f075628a268d689cbf65e2556b1e0781b7 +// SHA256STAMP:18c1c9ce4dfed92c5fc6809cf716bf31cbb39fb8db124d43ead013088aff8b7c diff --git a/gossipd/gossipd_wiregen.c b/gossipd/gossipd_wiregen.c index f49b3d69c..0b8396ead 100644 --- a/gossipd/gossipd_wiregen.c +++ b/gossipd/gossipd_wiregen.c @@ -857,4 +857,4 @@ bool fromwire_gossipd_new_blockheight(const void *p, u32 *blockheight) *blockheight = fromwire_u32(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:957869c71b6b3ea4d1ec80c7ea4aa093b3738a4d9bc4d145fc429691ae7338e7 +// SHA256STAMP:b9a39b664d2a598fb69e39147ff5d66e1abe5c9493db4a511bba6d2ecbcdfe29 diff --git a/gossipd/gossipd_wiregen.h b/gossipd/gossipd_wiregen.h index d45a3e543..b97850bbd 100644 --- a/gossipd/gossipd_wiregen.h +++ b/gossipd/gossipd_wiregen.h @@ -199,4 +199,4 @@ bool fromwire_gossipd_new_blockheight(const void *p, u32 *blockheight); #endif /* LIGHTNING_GOSSIPD_GOSSIPD_WIREGEN_H */ -// SHA256STAMP:957869c71b6b3ea4d1ec80c7ea4aa093b3738a4d9bc4d145fc429691ae7338e7 +// SHA256STAMP:b9a39b664d2a598fb69e39147ff5d66e1abe5c9493db4a511bba6d2ecbcdfe29 diff --git a/hsmd/hsmd_wiregen.c b/hsmd/hsmd_wiregen.c index fadda2f25..622b84907 100644 --- a/hsmd/hsmd_wiregen.c +++ b/hsmd/hsmd_wiregen.c @@ -1214,4 +1214,4 @@ bool fromwire_hsmd_get_output_scriptpubkey_reply(const tal_t *ctx, const void *p fromwire_u8_array(&cursor, &plen, *script, script_len); return cursor != NULL; } -// SHA256STAMP:abae586a8f129c46f47522b542ff868bdbdab5bda085c0874dbde87dccee4ac0 +// SHA256STAMP:bbfe5b669e8a931aa5426be248dc8320a48f22fd5231612dfc1ce22a6f300668 diff --git a/hsmd/hsmd_wiregen.h b/hsmd/hsmd_wiregen.h index 7f6defeca..4fe31a760 100644 --- a/hsmd/hsmd_wiregen.h +++ b/hsmd/hsmd_wiregen.h @@ -271,4 +271,4 @@ bool fromwire_hsmd_get_output_scriptpubkey_reply(const tal_t *ctx, const void *p #endif /* LIGHTNING_HSMD_HSMD_WIREGEN_H */ -// SHA256STAMP:abae586a8f129c46f47522b542ff868bdbdab5bda085c0874dbde87dccee4ac0 +// SHA256STAMP:bbfe5b669e8a931aa5426be248dc8320a48f22fd5231612dfc1ce22a6f300668 diff --git a/onchaind/onchaind_wiregen.c b/onchaind/onchaind_wiregen.c index 178d0a04d..0b691a49c 100644 --- a/onchaind/onchaind_wiregen.c +++ b/onchaind/onchaind_wiregen.c @@ -635,4 +635,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:41d048b3838729465dedb317e7e44c381f6c96f02b78d2423ef504d01d5898f8 +// SHA256STAMP:3e82025758cfaf2467242d259ac50c2ca66de3a8eabc1ff905aeb3effca0e5c7 diff --git a/onchaind/onchaind_wiregen.h b/onchaind/onchaind_wiregen.h index f408ad71b..7bc48974b 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:41d048b3838729465dedb317e7e44c381f6c96f02b78d2423ef504d01d5898f8 +// SHA256STAMP:3e82025758cfaf2467242d259ac50c2ca66de3a8eabc1ff905aeb3effca0e5c7 diff --git a/openingd/dualopend_wiregen.c b/openingd/dualopend_wiregen.c index 9e0715387..d5208c31b 100644 --- a/openingd/dualopend_wiregen.c +++ b/openingd/dualopend_wiregen.c @@ -485,4 +485,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak) *leak = fromwire_bool(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:d7f4b124313a7d21052b25e737ec35bf6f5dfa3db37aa5ec13ac8cef8c120190 +// SHA256STAMP:48dcbf79652c7cde9ad129b137cc60be72be6232ed20a8c2675a00f427ab6f91 diff --git a/openingd/dualopend_wiregen.h b/openingd/dualopend_wiregen.h index f1bef2fcc..3457a363b 100644 --- a/openingd/dualopend_wiregen.h +++ b/openingd/dualopend_wiregen.h @@ -109,4 +109,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak); #endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */ -// SHA256STAMP:d7f4b124313a7d21052b25e737ec35bf6f5dfa3db37aa5ec13ac8cef8c120190 +// SHA256STAMP:48dcbf79652c7cde9ad129b137cc60be72be6232ed20a8c2675a00f427ab6f91 diff --git a/openingd/openingd_wiregen.c b/openingd/openingd_wiregen.c index cd8ad0c3a..3e7c36cb0 100644 --- a/openingd/openingd_wiregen.c +++ b/openingd/openingd_wiregen.c @@ -579,4 +579,4 @@ bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak) *leak = fromwire_bool(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:9c977c121d6ff95a6680804710457cf353ee1bb0686a4e51045017b7590fb428 +// SHA256STAMP:2d53106a700f181fa46b0c82a9cb65e823bb9c39ec116adf72d24b52e27e05b6 diff --git a/openingd/openingd_wiregen.h b/openingd/openingd_wiregen.h index dc2b2dc2f..c69e998a6 100644 --- a/openingd/openingd_wiregen.h +++ b/openingd/openingd_wiregen.h @@ -121,4 +121,4 @@ bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak); #endif /* LIGHTNING_OPENINGD_OPENINGD_WIREGEN_H */ -// SHA256STAMP:9c977c121d6ff95a6680804710457cf353ee1bb0686a4e51045017b7590fb428 +// SHA256STAMP:2d53106a700f181fa46b0c82a9cb65e823bb9c39ec116adf72d24b52e27e05b6 diff --git a/tools/gen/header_template b/tools/gen/header_template index 72e3acefd..8b6203592 100644 --- a/tools/gen/header_template +++ b/tools/gen/header_template @@ -121,7 +121,7 @@ bool ${tlv.name}_is_valid(const struct ${tlv.struct_name()} *record, size_t *err_index); % if tlv.name in options.expose_tlv_type: -#define TLVS_${tlv.name.upper()}_ARRAY_SIZE ${len(tlv.messages)} +#define TLVS_ARRAY_SIZE_${tlv.name} ${len(tlv.messages)} extern const struct tlv_record_type tlvs_${tlv.name}[]; <%! diff --git a/wire/common_wiregen.c b/wire/common_wiregen.c index 42d564e4c..f9eec8344 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:9d2e11b0a9eefdde3d80dc605aeda2c85089c894388740b1d94d7ca97bd95acc +// SHA256STAMP:83d7a6305b316f37ff2278d9c4fb2c9efa9381688b78b84dd0a8928ca67e1563 diff --git a/wire/common_wiregen.h b/wire/common_wiregen.h index 4a46a183b..80e9668f3 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:9d2e11b0a9eefdde3d80dc605aeda2c85089c894388740b1d94d7ca97bd95acc +// SHA256STAMP:83d7a6305b316f37ff2278d9c4fb2c9efa9381688b78b84dd0a8928ca67e1563 diff --git a/wire/onion_printgen.c b/wire/onion_printgen.c index e5a858189..e11f97642 100644 --- a/wire/onion_printgen.c +++ b/wire/onion_printgen.c @@ -653,4 +653,4 @@ void printonion_wire_tlv_message(const char *tlv_name, const u8 *msg) { printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_tlv_payload, ARRAY_SIZE(print_tlvs_tlv_payload)); } } -// SHA256STAMP:3edc0ac5906e013377cc195c01e5cb67274c2a7560f51b946ff5149d755d36bd +// SHA256STAMP:c330a3a671d28980727dc42fb48b8f9051ee609c96445333105b7d5ab15d0ede diff --git a/wire/onion_printgen.h b/wire/onion_printgen.h index cfd8dd1a8..e1d48a898 100644 --- a/wire/onion_printgen.h +++ b/wire/onion_printgen.h @@ -57,4 +57,4 @@ void printwire_mpp_timeout(const char *fieldname, const u8 *cursor); #endif /* LIGHTNING_WIRE_ONION_PRINTGEN_H */ -// SHA256STAMP:3edc0ac5906e013377cc195c01e5cb67274c2a7560f51b946ff5149d755d36bd +// SHA256STAMP:c330a3a671d28980727dc42fb48b8f9051ee609c96445333105b7d5ab15d0ede diff --git a/wire/onion_wiregen.c b/wire/onion_wiregen.c index bdc7c9633..4f684dedc 100644 --- a/wire/onion_wiregen.c +++ b/wire/onion_wiregen.c @@ -697,4 +697,4 @@ bool fromwire_mpp_timeout(const void *p) return false; return cursor != NULL; } -// SHA256STAMP:3edc0ac5906e013377cc195c01e5cb67274c2a7560f51b946ff5149d755d36bd +// SHA256STAMP:c330a3a671d28980727dc42fb48b8f9051ee609c96445333105b7d5ab15d0ede diff --git a/wire/onion_wiregen.h b/wire/onion_wiregen.h index c5c5f9ea0..bb5965c70 100644 --- a/wire/onion_wiregen.h +++ b/wire/onion_wiregen.h @@ -104,7 +104,7 @@ void towire_tlv_payload(u8 **pptr, const struct tlv_tlv_payload *record); bool tlv_payload_is_valid(const struct tlv_tlv_payload *record, size_t *err_index); -#define TLVS_TLV_PAYLOAD_ARRAY_SIZE 4 +#define TLVS_ARRAY_SIZE_tlv_payload 4 extern const struct tlv_record_type tlvs_tlv_payload[]; @@ -207,4 +207,4 @@ bool fromwire_mpp_timeout(const void *p); #endif /* LIGHTNING_WIRE_ONION_WIREGEN_H */ -// SHA256STAMP:3edc0ac5906e013377cc195c01e5cb67274c2a7560f51b946ff5149d755d36bd +// SHA256STAMP:c330a3a671d28980727dc42fb48b8f9051ee609c96445333105b7d5ab15d0ede diff --git a/wire/peer_printgen.c b/wire/peer_printgen.c index 8b41be04c..bc7d9d81d 100644 --- a/wire/peer_printgen.c +++ b/wire/peer_printgen.c @@ -2036,4 +2036,4 @@ void printpeer_wire_tlv_message(const char *tlv_name, const u8 *msg) { printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_reply_channel_range_tlvs, ARRAY_SIZE(print_tlvs_reply_channel_range_tlvs)); } } -// SHA256STAMP:a2fdacbfaf7025bcb919b426f2e17fdc317a0bc6a80fe3c05f5dedac30f00256 +// SHA256STAMP:cda6c1b9f5b71e94ce4d2791a16dfeddc52ea3b2ad09ce4915101fe6e41dfc92 diff --git a/wire/peer_printgen.h b/wire/peer_printgen.h index 23c3b37e5..6459025b8 100644 --- a/wire/peer_printgen.h +++ b/wire/peer_printgen.h @@ -70,4 +70,4 @@ void printwire_gossip_timestamp_filter(const char *fieldname, const u8 *cursor); void printwire_channel_update_checksums(const char *fieldname, const u8 **cursor, size_t *plen); void printwire_channel_update_timestamps(const char *fieldname, const u8 **cursor, size_t *plen); #endif /* LIGHTNING_WIRE_PEER_PRINTGEN_H */ -// SHA256STAMP:a2fdacbfaf7025bcb919b426f2e17fdc317a0bc6a80fe3c05f5dedac30f00256 +// SHA256STAMP:cda6c1b9f5b71e94ce4d2791a16dfeddc52ea3b2ad09ce4915101fe6e41dfc92 diff --git a/wire/peer_wiregen.c b/wire/peer_wiregen.c index 78bd51468..f81ae5475 100644 --- a/wire/peer_wiregen.c +++ b/wire/peer_wiregen.c @@ -1630,4 +1630,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:a2fdacbfaf7025bcb919b426f2e17fdc317a0bc6a80fe3c05f5dedac30f00256 +// SHA256STAMP:cda6c1b9f5b71e94ce4d2791a16dfeddc52ea3b2ad09ce4915101fe6e41dfc92 diff --git a/wire/peer_wiregen.h b/wire/peer_wiregen.h index 6fc1b8385..d4dde57f7 100644 --- a/wire/peer_wiregen.h +++ b/wire/peer_wiregen.h @@ -223,7 +223,7 @@ void towire_n1(u8 **pptr, const struct tlv_n1 *record); bool n1_is_valid(const struct tlv_n1 *record, size_t *err_index); -#define TLVS_N1_ARRAY_SIZE 4 +#define TLVS_ARRAY_SIZE_n1 4 extern const struct tlv_record_type tlvs_n1[]; @@ -273,7 +273,7 @@ void towire_n2(u8 **pptr, const struct tlv_n2 *record); bool n2_is_valid(const struct tlv_n2 *record, size_t *err_index); -#define TLVS_N2_ARRAY_SIZE 2 +#define TLVS_ARRAY_SIZE_n2 2 extern const struct tlv_record_type tlvs_n2[]; @@ -595,4 +595,4 @@ bool fromwire_channel_update_option_channel_htlc_max(const void *p, secp256k1_ec #endif /* LIGHTNING_WIRE_PEER_WIREGEN_H */ -// SHA256STAMP:a2fdacbfaf7025bcb919b426f2e17fdc317a0bc6a80fe3c05f5dedac30f00256 +// SHA256STAMP:cda6c1b9f5b71e94ce4d2791a16dfeddc52ea3b2ad09ce4915101fe6e41dfc92 diff --git a/wire/tlvstream.c b/wire/tlvstream.c index 7c8e5afd2..f46b3ef3e 100644 --- a/wire/tlvstream.c +++ b/wire/tlvstream.c @@ -271,3 +271,27 @@ void towire_tlv(u8 **pptr, tal_free(val); } } + +struct tlv_field *tlv_make_fields_(const struct tlv_record_type *types, + size_t num_types, + const void *record) +{ + struct tlv_field *fields = tal_arr(record, struct tlv_field, 0); + + for (size_t i = 0; i < num_types; i++) { + struct tlv_field f; + u8 *val; + if (i != 0) + assert(types[i].type > types[i-1].type); + val = types[i].towire(NULL, record); + if (!val) + continue; + + f.meta = &types[i]; + f.numtype = types[i].type; + f.length = tal_bytelen(val); + f.value = tal_steal(fields, val); + tal_arr_expand(&fields, f); + } + return fields; +} diff --git a/wire/tlvstream.h b/wire/tlvstream.h index a6a12982b..d0da839cd 100644 --- a/wire/tlvstream.h +++ b/wire/tlvstream.h @@ -30,6 +30,14 @@ struct tlv_field { /* Given any tlvstream serialize the raw fields (untyped ones). */ void towire_tlvstream_raw(u8 **pptr, const struct tlv_field *fields); +/* Given a tlv record with manually-set fields, populate ->fields */ +#define tlv_make_fields(tlv, type) \ + tlv_make_fields_(tlvs_##type, TLVS_ARRAY_SIZE_##type, (tlv)) + +struct tlv_field *tlv_make_fields_(const struct tlv_record_type *types, + size_t num_types, + const void *record); + /* Generic TLV decode/encode */ bool fromwire_tlv(const u8 **cursor, size_t *max, const struct tlv_record_type *types, size_t num_types,