diff --git a/Makefile b/Makefile index 50049aa09..7bdbc0119 100644 --- a/Makefile +++ b/Makefile @@ -253,6 +253,14 @@ config.vars: %.o: %.c @$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<) +# '_exp' inserted before _wiregen.[ch] to demark experimental +# spec-derived headers, which are *not* committed into git. +ifeq ($(EXPERIMENTAL_FEATURES),1) +EXP := _exp +else +EXP := +endif + # Git doesn't maintain timestamps, so we only regen if sources actually changed: # We place the SHA inside some generated files so we can tell if they need updating. # Usage: $(call SHA256STAMP_CHANGED) @@ -262,16 +270,16 @@ SHA256STAMP = echo '$(1) SHA256STAMP:'`cat $(filter-out FORCE,$^) | sha256sum | # generate-wire.py --page [header|impl] hdrfilename wirename < csv > file %_wiregen.h: %_wire.csv $(WIRE_GEN_DEPS) - @if $(call SHA256STAMP_CHANGED); then $(call VERBOSE,"wiregen $@",tools/generate-wire.py --page header $($@_args) $@ `basename $< .csv` < $< > $@ && $(call SHA256STAMP,//)); fi + @if $(call SHA256STAMP_CHANGED); then $(call VERBOSE,"wiregen $@",tools/generate-wire.py --page header $($@_args) $@ `basename $< .csv | sed 's/_exp_/_/'` < $< > $@ && $(call SHA256STAMP,//)); fi %_wiregen.c: %_wire.csv $(WIRE_GEN_DEPS) - @if $(call SHA256STAMP_CHANGED); then $(call VERBOSE,"wiregen $@",tools/generate-wire.py --page impl $($@_args) ${@:.c=.h} `basename $< .csv` < $< > $@ && $(call SHA256STAMP,//)); fi + @if $(call SHA256STAMP_CHANGED); then $(call VERBOSE,"wiregen $@",tools/generate-wire.py --page impl $($@_args) ${@:.c=.h} `basename $< .csv | sed 's/_exp_/_/'` < $< > $@ && $(call SHA256STAMP,//)); fi %_printgen.h: %_wire.csv $(WIRE_GEN_DEPS) - @if $(call SHA256STAMP_CHANGED); then $(call VERBOSE,"printgen $@",tools/generate-wire.py -s -P --page header $($@_args) $@ `basename $< .csv` < $< > $@ && $(call SHA256STAMP,//)); fi + @if $(call SHA256STAMP_CHANGED); then $(call VERBOSE,"printgen $@",tools/generate-wire.py -s -P --page header $($@_args) $@ `basename $< .csv | sed 's/_exp_/_/'` < $< > $@ && $(call SHA256STAMP,//)); fi %_printgen.c: %_wire.csv $(WIRE_GEN_DEPS) - @if $(call SHA256STAMP_CHANGED); then $(call VERBOSE,"printgen $@",tools/generate-wire.py -s -P --page impl $($@_args) ${@:.c=.h} `basename $< .csv` < $< > $@ && $(call SHA256STAMP,//)); fi + @if $(call SHA256STAMP_CHANGED); then $(call VERBOSE,"printgen $@",tools/generate-wire.py -s -P --page impl $($@_args) ${@:.c=.h} `basename $< .csv | sed 's/_exp_/_/'` < $< > $@ && $(call SHA256STAMP,//)); fi include external/Makefile include bitcoin/Makefile diff --git a/channeld/channeld.c b/channeld/channeld.c index 07f48f898..95d8df756 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -63,7 +63,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/channeld/channeld_htlc.h b/channeld/channeld_htlc.h index 5913a500e..118d9321f 100644 --- a/channeld/channeld_htlc.h +++ b/channeld/channeld_htlc.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include struct htlc { /* What's the status. */ diff --git a/common/decode_array.c b/common/decode_array.c index 37e482618..f2da3018d 100644 --- a/common/decode_array.c +++ b/common/decode_array.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include diff --git a/common/dev_disconnect.c b/common/dev_disconnect.c index 13cfa3c79..b3d7c07ef 100644 --- a/common/dev_disconnect.c +++ b/common/dev_disconnect.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #if DEVELOPER /* We move the fd if and only if we do a disconnect. */ diff --git a/common/gossip_rcvd_filter.c b/common/gossip_rcvd_filter.c index 94f8ed4b7..05f0dae77 100644 --- a/common/gossip_rcvd_filter.c +++ b/common/gossip_rcvd_filter.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include static u64 msg_key(const u8 *msg) { diff --git a/common/gossip_store.c b/common/gossip_store.c index 89a1c69d0..4d49bf396 100644 --- a/common/gossip_store.c +++ b/common/gossip_store.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include void gossip_setup_timestamp_filter(struct per_peer_state *pps, u32 first_timestamp, diff --git a/common/gossmap.c b/common/gossmap.c index 1f51ebd61..ee46abae6 100644 --- a/common/gossmap.c +++ b/common/gossmap.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include /* We need this global to decode indexes for hash functions */ static struct gossmap *map; diff --git a/common/htlc_wire.h b/common/htlc_wire.h index 743a743fb..e5d085e13 100644 --- a/common/htlc_wire.h +++ b/common/htlc_wire.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include struct bitcoin_tx; struct shachain; diff --git a/common/onion.c b/common/onion.c index bd82eea7b..acb8b8ad7 100644 --- a/common/onion.c +++ b/common/onion.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include /* BOLT #4: * diff --git a/common/ping.c b/common/ping.c index 5aed86670..8322e55a5 100644 --- a/common/ping.c +++ b/common/ping.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include bool check_ping_make_pong(const tal_t *ctx, const u8 *ping, u8 **pong) { diff --git a/common/sphinx.h b/common/sphinx.h index 18f924a7f..daad044e0 100644 --- a/common/sphinx.h +++ b/common/sphinx.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include struct node_id; diff --git a/common/test/Makefile b/common/test/Makefile index dfabba4d6..42065c669 100644 --- a/common/test/Makefile +++ b/common/test/Makefile @@ -13,7 +13,7 @@ ALL_C_SOURCES += $(COMMON_TEST_SRC) ALL_TEST_PROGRAMS += $(COMMON_TEST_PROGRAMS) # Sphinx test wants to decode TLVs. -common/test/run-sphinx: wire/onion_wiregen.o wire/towire.o wire/fromwire.o +common/test/run-sphinx: wire/onion$(EXP)_wiregen.o wire/towire.o wire/fromwire.o common/test/run-param \ common/test/run-json: \ @@ -25,7 +25,7 @@ common/test/run-json: \ common/wireaddr.o \ common/type_to_string.o \ wire/fromwire.o \ - wire/onion_wiregen.o \ + wire/onion$(EXP)_wiregen.o \ wire/towire.o update-mocks: $(COMMON_TEST_SRC:%=update-mocks/%) diff --git a/common/wire_error.c b/common/wire_error.c index 537c51f02..67f6b773f 100644 --- a/common/wire_error.c +++ b/common/wire_error.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include u8 *towire_errorfmtv(const tal_t *ctx, const struct channel_id *channel, diff --git a/connectd/Makefile b/connectd/Makefile index 5b4e34327..27cec25bb 100644 --- a/connectd/Makefile +++ b/connectd/Makefile @@ -63,7 +63,7 @@ CONNECTD_COMMON_OBJS := \ common/wire_error.o \ gossipd/gossipd_wiregen.o \ lightningd/gossip_msg.o \ - wire/onion_wiregen.o + wire/onion$(EXP)_wiregen.o lightningd/lightning_connectd: $(CONNECTD_OBJS) $(CONNECTD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(HSMD_CLIENT_OBJS) diff --git a/connectd/connectd.c b/connectd/connectd.c index 1fcd9414d..069a73436 100644 --- a/connectd/connectd.c +++ b/connectd/connectd.c @@ -68,7 +68,6 @@ #include #include #include -#include #include #include #include diff --git a/devtools/Makefile b/devtools/Makefile index ade001e35..d55ee1616 100644 --- a/devtools/Makefile +++ b/devtools/Makefile @@ -41,8 +41,8 @@ DEVTOOLS_COMMON_OBJS := \ common/utils.o \ common/version.o \ common/wireaddr.o \ - wire/onion_wiregen.o \ - wire/peer_wiregen.o + wire/onion$(EXP)_wiregen.o \ + wire/peer$(EXP)_wiregen.o devtools/bolt11-cli: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/bolt11-cli.o @@ -61,7 +61,7 @@ devtools/onion: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS devtools/blindedpath: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) common/blinding.o $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/blindedpath.o common/onion.o common/onionreply.o common/sphinx.o -devtools/gossipwith: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/peer_wiregen.o devtools/gossipwith.o common/cryptomsg.o common/cryptomsg.o common/crypto_sync.o +devtools/gossipwith: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/peer$(EXP)_wiregen.o devtools/gossipwith.o common/cryptomsg.o common/cryptomsg.o common/crypto_sync.o $(DEVTOOLS_OBJS) $(DEVTOOLS_TOOL_OBJS): wire/wire.h diff --git a/devtools/create-gossipstore.c b/devtools/create-gossipstore.c index a5699ad99..42c9db395 100644 --- a/devtools/create-gossipstore.c +++ b/devtools/create-gossipstore.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include struct scidsat { diff --git a/devtools/decodemsg.c b/devtools/decodemsg.c index 3bfd7d682..9e0650981 100644 --- a/devtools/decodemsg.c +++ b/devtools/decodemsg.c @@ -5,8 +5,13 @@ #include #include #include +#if EXPERIMENTAL_FEATURES +#include +#include +#else #include #include +#endif int main(int argc, char *argv[]) { diff --git a/devtools/dump-gossipstore.c b/devtools/dump-gossipstore.c index 9d05be4dd..43759e4e7 100644 --- a/devtools/dump-gossipstore.c +++ b/devtools/dump-gossipstore.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include int main(int argc, char *argv[]) { diff --git a/devtools/mkgossip.c b/devtools/mkgossip.c index 47fd81d70..9420e79f7 100644 --- a/devtools/mkgossip.c +++ b/devtools/mkgossip.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include static bool verbose = false; diff --git a/devtools/mkquery.c b/devtools/mkquery.c index b2f4911d5..27ca543f2 100644 --- a/devtools/mkquery.c +++ b/devtools/mkquery.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include static void usage(void) diff --git a/devtools/print_wire.h b/devtools/print_wire.h index a7300119c..58c013f5b 100644 --- a/devtools/print_wire.h +++ b/devtools/print_wire.h @@ -3,8 +3,8 @@ #include #include #include -#include -#include +#include +#include struct tlv_print_record_type { u64 type; diff --git a/gossipd/Makefile b/gossipd/Makefile index 72c97eb7f..8deed147f 100644 --- a/gossipd/Makefile +++ b/gossipd/Makefile @@ -66,7 +66,7 @@ GOSSIPD_COMMON_OBJS := \ common/wire_error.o \ connectd/connectd_gossipd_wiregen.o \ lightningd/gossip_msg.o \ - wire/onion_wiregen.o + wire/onion$(EXP)_wiregen.o lightningd/lightning_gossipd: $(GOSSIPD_OBJS) $(GOSSIPD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(HSMD_CLIENT_OBJS) diff --git a/gossipd/gossip_generation.c b/gossipd/gossip_generation.c index c4cea5c89..555a6150c 100644 --- a/gossipd/gossip_generation.c +++ b/gossipd/gossip_generation.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include /* Create a node_announcement with the given signature. It may be NULL in the diff --git a/gossipd/gossip_store.c b/gossipd/gossip_store.c index 04396e7d3..ed085c380 100644 --- a/gossipd/gossip_store.c +++ b/gossipd/gossip_store.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #define GOSSIP_STORE_FILENAME "gossip_store" diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index 0a6932b9d..7e48e3acf 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -63,7 +63,7 @@ #include #include #include -#include +#include #include #include diff --git a/gossipd/gossipd_wire.csv b/gossipd/gossipd_wire.csv index b91aaf9a7..4433d104e 100644 --- a/gossipd/gossipd_wire.csv +++ b/gossipd/gossipd_wire.csv @@ -1,7 +1,7 @@ #include #include #include -#include +#include # Initialize the gossip daemon. msgtype,gossipd_init,3000 diff --git a/gossipd/gossipd_wiregen.c b/gossipd/gossipd_wiregen.c index cf7992ea4..7f88f336f 100644 --- a/gossipd/gossipd_wiregen.c +++ b/gossipd/gossipd_wiregen.c @@ -858,4 +858,4 @@ bool fromwire_gossipd_new_blockheight(const void *p, u32 *blockheight) return cursor != NULL; } -// SHA256STAMP:4aa62af856e3554603b0038eb0c9c6f5623cdb8d17abb6650338d1b728babd4b +// SHA256STAMP:9ac18b60ff39a11d7871d17a660aa9661a49d2585abe25d0ba0e048c32ac02eb diff --git a/gossipd/gossipd_wiregen.h b/gossipd/gossipd_wiregen.h index 5361aa77b..83743247d 100644 --- a/gossipd/gossipd_wiregen.h +++ b/gossipd/gossipd_wiregen.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include @@ -200,4 +200,4 @@ bool fromwire_gossipd_new_blockheight(const void *p, u32 *blockheight); #endif /* LIGHTNING_GOSSIPD_GOSSIPD_WIREGEN_H */ -// SHA256STAMP:4aa62af856e3554603b0038eb0c9c6f5623cdb8d17abb6650338d1b728babd4b +// SHA256STAMP:9ac18b60ff39a11d7871d17a660aa9661a49d2585abe25d0ba0e048c32ac02eb diff --git a/gossipd/queries.c b/gossipd/queries.c index 62e557066..64e4ab00e 100644 --- a/gossipd/queries.c +++ b/gossipd/queries.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include diff --git a/gossipd/routing.c b/gossipd/routing.c index 87f25e954..ff8c15d35 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #ifndef SUPERVERBOSE #define SUPERVERBOSE(...) diff --git a/gossipd/routing.h b/gossipd/routing.h index 6c0c1b53f..346a5995a 100644 --- a/gossipd/routing.h +++ b/gossipd/routing.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include struct daemon; diff --git a/gossipd/seeker.c b/gossipd/seeker.c index 35656a2a1..79dda1dc7 100644 --- a/gossipd/seeker.c +++ b/gossipd/seeker.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #define GOSSIP_SEEKER_INTERVAL(seeker) \ DEV_FAST_GOSSIP((seeker)->daemon->rstate->dev_fast_gossip, 5, 60) diff --git a/gossipd/test/Makefile b/gossipd/test/Makefile index 24d22f2ca..2deca9f07 100644 --- a/gossipd/test/Makefile +++ b/gossipd/test/Makefile @@ -17,7 +17,7 @@ GOSSIPD_TEST_COMMON_OBJS := \ common/pseudorand.o \ common/type_to_string.o \ common/utils.o \ - wire/peer_wiregen.o \ + wire/peer$(EXP)_wiregen.o \ wire/fromwire.o \ wire/towire.o diff --git a/hsmd/hsmd.c b/hsmd/hsmd.c index 63604b89b..f4bd92a90 100644 --- a/hsmd/hsmd.c +++ b/hsmd/hsmd.c @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include /*~ Each subdaemon is started with stdin connected to lightningd (for status diff --git a/lightningd/connect_control.c b/lightningd/connect_control.c index e2cdd3c56..bb5a57b2a 100644 --- a/lightningd/connect_control.c +++ b/lightningd/connect_control.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include struct connect { diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 071e8f67b..a3b608ff5 100644 --- a/lightningd/gossip_control.c +++ b/lightningd/gossip_control.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include static void got_txout(struct bitcoind *bitcoind, diff --git a/lightningd/htlc_end.h b/lightningd/htlc_end.h index 554350c7c..c502ce44a 100644 --- a/lightningd/htlc_end.h +++ b/lightningd/htlc_end.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include /* We look up HTLCs by channel & id */ struct htlc_key { diff --git a/lightningd/htlc_set.h b/lightningd/htlc_set.h index 3657df192..573a92d07 100644 --- a/lightningd/htlc_set.h +++ b/lightningd/htlc_set.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include struct htlc_in; struct lightningd; diff --git a/lightningd/invoice.h b/lightningd/invoice.h index 1ccffda4a..4fba86064 100644 --- a/lightningd/invoice.h +++ b/lightningd/invoice.h @@ -1,7 +1,7 @@ #ifndef LIGHTNING_LIGHTNINGD_INVOICE_H #define LIGHTNING_LIGHTNINGD_INVOICE_H #include "config.h" -#include +#include struct amount_msat; struct htlc_set; diff --git a/lightningd/notification.h b/lightningd/notification.h index a0b248e1f..940479887 100644 --- a/lightningd/notification.h +++ b/lightningd/notification.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include struct onionreply; diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index f956c8d7f..694447229 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include struct close_command { diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 4e737bbd4..5729b9172 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #ifndef SUPERVERBOSE diff --git a/openingd/openingd.c b/openingd/openingd.c index af5383404..3520e3b93 100644 --- a/openingd/openingd.c +++ b/openingd/openingd.c @@ -52,7 +52,6 @@ #include #include #include -#include #include #include diff --git a/plugins/Makefile b/plugins/Makefile index 27160ef77..b8512c5cf 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -82,7 +82,7 @@ PLUGIN_COMMON_OBJS := \ common/version.o \ common/wireaddr.o \ wire/fromwire.o \ - wire/onion_wiregen.o \ + wire/onion$(EXP)_wiregen.o \ wire/tlvstream.o \ wire/towire.o @@ -95,7 +95,7 @@ plugins/fundchannel: common/addr.o $(PLUGIN_FUNDCHANNEL_OBJS) $(PLUGIN_LIB_OBJS) plugins/bcli: bitcoin/chainparams.o $(PLUGIN_BCLI_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) -plugins/keysend: bitcoin/chainparams.o wire/tlvstream.o wire/onion_wiregen.o $(PLUGIN_KEYSEND_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) +plugins/keysend: bitcoin/chainparams.o wire/tlvstream.o wire/onion$(EXP)_wiregen.o $(PLUGIN_KEYSEND_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER) $(PLUGIN_ALL_OBJS): $(PLUGIN_LIB_HEADER) diff --git a/plugins/keysend.c b/plugins/keysend.c index f21f51c32..40510ecc2 100644 --- a/plugins/keysend.c +++ b/plugins/keysend.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include #define PREIMAGE_TLV_TYPE 5482373484 #define KEYSEND_FEATUREBIT 55 diff --git a/plugins/libplugin-pay.h b/plugins/libplugin-pay.h index 8c5b5dfe0..4fc270dd9 100644 --- a/plugins/libplugin-pay.h +++ b/plugins/libplugin-pay.h @@ -4,7 +4,7 @@ #include #include -#include +#include struct legacy_payload { struct short_channel_id scid; diff --git a/tools/test/Makefile b/tools/test/Makefile index 66cdcc816..73610102a 100644 --- a/tools/test/Makefile +++ b/tools/test/Makefile @@ -42,7 +42,7 @@ tools/test/gen_test.c.tmp.c: $(TOOLS_WIRE_DEPS) tools/test/gen_test.c: tools/test/gen_test.c.tmp.c $(EXTERNAL_HEADERS) tools/test/gen_test.h @MAKE=$(MAKE) tools/update-mocks.sh "$<" $(SUPPRESS_OUTPUT) && mv "$<" "$@" -tools/test/gen_print.h: wire/onion_wiregen.h $(TOOLS_WIRE_DEPS) +tools/test/gen_print.h: wire/onion$(EXP)_wiregen.h $(TOOLS_WIRE_DEPS) $(BOLT_GEN) -P --page header $@ test_type < tools/test/test_cases > $@ tools/test/gen_print.c: $(TOOLS_WIRE_DEPS) diff --git a/wallet/wallet.h b/wallet/wallet.h index 18f38e79e..9c9566f8c 100644 --- a/wallet/wallet.h +++ b/wallet/wallet.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include struct amount_msat; struct invoices; diff --git a/wire/Makefile b/wire/Makefile index c0348e201..e1ee3c937 100644 --- a/wire/Makefile +++ b/wire/Makefile @@ -2,15 +2,16 @@ WIRE_HEADERS := wire/onion_defs.h \ wire/peer_wire.h \ + wire/onion_wire.h \ wire/tlvstream.h \ wire/wire.h \ wire/wire_sync.h \ wire/wire_io.h \ - wire/peer_wiregen.h \ - wire/onion_wiregen.h \ + wire/peer$(EXP)_wiregen.h \ + wire/onion$(EXP)_wiregen.h \ wire/common_wiregen.h \ - wire/peer_printgen.h \ - wire/onion_printgen.h + wire/peer$(EXP)_printgen.h \ + wire/onion$(EXP)_printgen.h # We don't include peer_printgen/onion_printgen here since most don't need it. WIRE_SRC := wire/wire_sync.c \ @@ -20,12 +21,12 @@ WIRE_SRC := wire/wire_sync.c \ wire/tlvstream.c \ wire/towire.c \ wire/common_wiregen.c \ - wire/peer_wiregen.c \ - wire/onion_wiregen.c + wire/peer$(EXP)_wiregen.c \ + wire/onion$(EXP)_wiregen.c WIRE_PRINT_SRC := \ - wire/onion_printgen.c \ - wire/peer_printgen.c + wire/onion$(EXP)_printgen.c \ + wire/peer$(EXP)_printgen.c WIRE_OBJS := $(WIRE_SRC:.c=.o) WIRE_PRINT_OBJS := $(WIRE_PRINT_SRC:.c=.o) @@ -61,23 +62,13 @@ ifeq ($(EXPERIMENTAL_FEATURES),1) EXPERIMENTAL_PEER_PATCHES := $(sort $(wildcard wire/extracted_peer_experimental_*)) EXPERIMENTAL_ONION_PATCHES := $(sort $(wildcard wire/extracted_onion_experimental_*)) -wire/peer_wire.csv: wire/extracted_peer_wire_csv $(EXPERIMENTAL_PEER_PATCHES) +wire/peer_exp_wire.csv: wire/peer_wire_csv $(EXPERIMENTAL_PEER_PATCHES) @set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_PEER_PATCHES); do patch $@.$$$$ $$exp >/dev/null ; done; mv $@.$$$$ $@ -wire/onion_wire.csv: wire/extracted_onion_wire_csv $(EXPERIMENTAL_ONION_PATCHES) +wire/onion_exp_wire.csv: wire/onion_wire_csv $(EXPERIMENTAL_ONION_PATCHES) @set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_ONION_PATCHES); do patch $@.$$$$ $$exp; done >/dev/null ; mv $@.$$$$ $@ - -else # /* EXPERIMENTAL_FEATURES */ -wire/peer_wire.csv: wire/extracted_peer_wire_csv - @cp $< $@ - -wire/onion_wire.csv: wire/extracted_onion_wire_csv - @cp $< $@ endif -# We (may) need to rebuild these if config changes -wire/peer_wire.csv wire/onion_wire.csv: config.vars - # tlvs_n1 and n2 are used for test vectors, thus not referenced: expose them # for testing and to prevent compile error about them being unused. # This will be easier if test vectors are moved to separate files. @@ -90,6 +81,12 @@ 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.c_args := $(wire/peer_wiregen.c_args) +wire/onion_exp_wiregen.h_args := $(wire/onion_wiregen.h_args) +wire/onion_exp_wiregen.c_args := $(wire/onion_wiregen.c_args) + maintainer-clean: wire-maintainer-clean wire-maintainer-clean: diff --git a/wire/onion_wire.h b/wire/onion_wire.h new file mode 100644 index 000000000..63bea4684 --- /dev/null +++ b/wire/onion_wire.h @@ -0,0 +1,12 @@ +#ifndef LIGHTNING_WIRE_ONION_WIRE_H +#define LIGHTNING_WIRE_ONION_WIRE_H +#include "config.h" +#include + +#if EXPERIMENTAL_FEATURES +#include +#else +#include +#endif + +#endif /* LIGHTNING_WIRE_ONION_WIRE_H */ diff --git a/wire/extracted_onion_wire_csv b/wire/onion_wire_csv similarity index 100% rename from wire/extracted_onion_wire_csv rename to wire/onion_wire_csv diff --git a/wire/peer_wire.h b/wire/peer_wire.h index 008410304..12c951b8f 100644 --- a/wire/peer_wire.h +++ b/wire/peer_wire.h @@ -2,7 +2,12 @@ #define LIGHTNING_WIRE_PEER_WIRE_H #include "config.h" #include + +#if EXPERIMENTAL_FEATURES +#include +#else #include +#endif /* BOLT #1: * diff --git a/wire/extracted_peer_wire_csv b/wire/peer_wire_csv similarity index 100% rename from wire/extracted_peer_wire_csv rename to wire/peer_wire_csv diff --git a/wire/test/Makefile b/wire/test/Makefile index db7bf7a54..154f92ea3 100644 --- a/wire/test/Makefile +++ b/wire/test/Makefile @@ -21,4 +21,4 @@ $(WIRE_TEST_OBJS): $(WIRE_HEADERS) $(WIRE_SRC) $(WIRE_PRINT_SRC) wire-tests: $(WIRE_TEST_PROGRAMS:%=unittest/%) -wire/test/run-peer-wire: wire/peer_wiregen.o common/bigsize.o +wire/test/run-peer-wire: wire/peer$(EXP)_wiregen.o common/bigsize.o diff --git a/wire/test/run-peer-wire.c b/wire/test/run-peer-wire.c index c5b7e54f3..a9acefb93 100644 --- a/wire/test/run-peer-wire.c +++ b/wire/test/run-peer-wire.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include extern secp256k1_context *secp256k1_ctx; diff --git a/wire/test/run-tlvstream.c b/wire/test/run-tlvstream.c index dd05357c5..f7991edb6 100644 --- a/wire/test/run-tlvstream.c +++ b/wire/test/run-tlvstream.c @@ -13,7 +13,11 @@ static const char *reason; #include #include +#if EXPERIMENTAL_FEATURES +#include +#else #include +#endif #include #include