Browse Source

Makefile: use completely separate spec-derived files for EXPERIMENTAL_FEATURES

This avoids overwriting the ones in git, and generally makes things neater.

We have convenience headers wire/peer_wire.h and wire/onion_wire.h to
avoid most #ifdefs: simply include those.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
bump-pyln-proto
Rusty Russell 4 years ago
parent
commit
c34c055d82
  1. 16
      Makefile
  2. 2
      channeld/channeld.c
  3. 2
      channeld/channeld_htlc.h
  4. 2
      common/decode_array.c
  5. 2
      common/dev_disconnect.c
  6. 2
      common/gossip_rcvd_filter.c
  7. 2
      common/gossip_store.c
  8. 2
      common/gossmap.c
  9. 2
      common/htlc_wire.h
  10. 2
      common/onion.c
  11. 2
      common/ping.c
  12. 2
      common/sphinx.h
  13. 4
      common/test/Makefile
  14. 2
      common/wire_error.c
  15. 2
      connectd/Makefile
  16. 1
      connectd/connectd.c
  17. 6
      devtools/Makefile
  18. 2
      devtools/create-gossipstore.c
  19. 5
      devtools/decodemsg.c
  20. 2
      devtools/dump-gossipstore.c
  21. 2
      devtools/mkgossip.c
  22. 2
      devtools/mkquery.c
  23. 4
      devtools/print_wire.h
  24. 2
      gossipd/Makefile
  25. 2
      gossipd/gossip_generation.c
  26. 2
      gossipd/gossip_store.c
  27. 2
      gossipd/gossipd.c
  28. 2
      gossipd/gossipd_wire.csv
  29. 2
      gossipd/gossipd_wiregen.c
  30. 4
      gossipd/gossipd_wiregen.h
  31. 2
      gossipd/queries.c
  32. 2
      gossipd/routing.c
  33. 2
      gossipd/routing.h
  34. 2
      gossipd/seeker.c
  35. 2
      gossipd/test/Makefile
  36. 2
      hsmd/hsmd.c
  37. 2
      lightningd/connect_control.c
  38. 2
      lightningd/gossip_control.c
  39. 2
      lightningd/htlc_end.h
  40. 2
      lightningd/htlc_set.h
  41. 2
      lightningd/invoice.h
  42. 2
      lightningd/notification.h
  43. 2
      lightningd/peer_control.c
  44. 2
      lightningd/peer_htlcs.c
  45. 1
      openingd/openingd.c
  46. 4
      plugins/Makefile
  47. 2
      plugins/keysend.c
  48. 2
      plugins/libplugin-pay.h
  49. 2
      tools/test/Makefile
  50. 2
      wallet/wallet.h
  51. 37
      wire/Makefile
  52. 12
      wire/onion_wire.h
  53. 0
      wire/onion_wire_csv
  54. 5
      wire/peer_wire.h
  55. 0
      wire/peer_wire_csv
  56. 2
      wire/test/Makefile
  57. 2
      wire/test/run-peer-wire.c
  58. 4
      wire/test/run-tlvstream.c

16
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

2
channeld/channeld.c

@ -63,7 +63,7 @@
#include <sodium/crypto_aead_chacha20poly1305.h>
#include <stdio.h>
#include <wire/common_wiregen.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
#include <wire/peer_wire.h>
#include <wire/wire.h>
#include <wire/wire_io.h>

2
channeld/channeld_htlc.h

@ -6,7 +6,7 @@
#include <common/amount.h>
#include <common/htlc.h>
#include <common/pseudorand.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
struct htlc {
/* What's the status. */

2
common/decode_array.c

@ -1,7 +1,7 @@
#include <ccan/cast/cast.h>
#include <common/decode_array.h>
#include <common/utils.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#include <wire/wire.h>
#include <zlib.h>

2
common/dev_disconnect.c

@ -11,7 +11,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#if DEVELOPER
/* We move the fd if and only if we do a disconnect. */

2
common/gossip_rcvd_filter.c

@ -4,7 +4,7 @@
#include <common/gossip_rcvd_filter.h>
#include <common/memleak.h>
#include <common/pseudorand.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
static u64 msg_key(const u8 *msg)
{

2
common/gossip_store.c

@ -9,7 +9,7 @@
#include <errno.h>
#include <inttypes.h>
#include <unistd.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
void gossip_setup_timestamp_filter(struct per_peer_state *pps,
u32 first_timestamp,

2
common/gossmap.c

@ -20,7 +20,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
/* We need this global to decode indexes for hash functions */
static struct gossmap *map;

2
common/htlc_wire.h

@ -6,7 +6,7 @@
#include <common/amount.h>
#include <common/htlc.h>
#include <common/sphinx.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
struct bitcoin_tx;
struct shachain;

2
common/onion.c

@ -5,7 +5,7 @@
#include <common/ecdh.h>
#include <common/sphinx.h>
#include <sodium/crypto_aead_chacha20poly1305.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
/* BOLT #4:
*

2
common/ping.c

@ -1,7 +1,7 @@
#include <common/ping.h>
#include <common/status.h>
#include <common/version.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
bool check_ping_make_pong(const tal_t *ctx, const u8 *ping, u8 **pong)
{

2
common/sphinx.h

@ -10,7 +10,7 @@
#include <common/hmac.h>
#include <secp256k1.h>
#include <sodium/randombytes.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
struct node_id;

4
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/%)

2
common/wire_error.c

@ -3,7 +3,7 @@
#include <common/type_to_string.h>
#include <common/utils.h>
#include <common/wire_error.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
u8 *towire_errorfmtv(const tal_t *ctx,
const struct channel_id *channel,

2
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)

1
connectd/connectd.c

@ -68,7 +68,6 @@
#include <sys/un.h>
#include <unistd.h>
#include <wire/peer_wire.h>
#include <wire/peer_wiregen.h>
#include <wire/wire_io.h>
#include <wire/wire_sync.h>
#include <zlib.h>

6
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

2
devtools/create-gossipstore.c

@ -16,7 +16,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
struct scidsat {

5
devtools/decodemsg.c

@ -5,8 +5,13 @@
#include <common/utils.h>
#include <stdio.h>
#include <unistd.h>
#if EXPERIMENTAL_FEATURES
#include <wire/onion_exp_printgen.h>
#include <wire/peer_exp_printgen.h>
#else
#include <wire/onion_printgen.h>
#include <wire/peer_printgen.h>
#endif
int main(int argc, char *argv[])
{

2
devtools/dump-gossipstore.c

@ -12,7 +12,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
int main(int argc, char *argv[])
{

2
devtools/mkgossip.c

@ -21,7 +21,7 @@
#include <common/type_to_string.h>
#include <common/utils.h>
#include <inttypes.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#include <stdio.h>
static bool verbose = false;

2
devtools/mkquery.c

@ -11,7 +11,7 @@
#include <common/gossip_constants.h>
#include <common/utils.h>
#include <inttypes.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#include <stdio.h>
static void usage(void)

4
devtools/print_wire.h

@ -3,8 +3,8 @@
#include <bitcoin/preimage.h>
#include <bitcoin/tx.h>
#include <common/wireaddr.h>
#include <wire/peer_wiregen.h>
#include <wire/onion_wiregen.h>
#include <wire/peer_wire.h>
#include <wire/onion_wire.h>
struct tlv_print_record_type {
u64 type;

2
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)

2
gossipd/gossip_generation.c

@ -14,7 +14,7 @@
#include <gossipd/gossipd.h>
#include <gossipd/gossipd_peerd_wiregen.h>
#include <hsmd/hsmd_wiregen.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#include <wire/wire_sync.h>
/* Create a node_announcement with the given signature. It may be NULL in the

2
gossipd/gossip_store.c

@ -18,7 +18,7 @@
#include <sys/stat.h>
#include <sys/uio.h>
#include <unistd.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#include <wire/wire.h>
#define GOSSIP_STORE_FILENAME "gossip_store"

2
gossipd/gossipd.c

@ -63,7 +63,7 @@
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#include <wire/wire_io.h>
#include <wire/wire_sync.h>

2
gossipd/gossipd_wire.csv

@ -1,7 +1,7 @@
#include <common/cryptomsg.h>
#include <common/features.h>
#include <common/wireaddr.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
# Initialize the gossip daemon.
msgtype,gossipd_init,3000

Can't render this file because it has a wrong number of fields in line 7.

2
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

4
gossipd/gossipd_wiregen.h

@ -10,7 +10,7 @@
#include <common/cryptomsg.h>
#include <common/features.h>
#include <common/wireaddr.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
#include <lightningd/gossip_msg.h>
#include <common/bolt11.h>
@ -200,4 +200,4 @@ bool fromwire_gossipd_new_blockheight(const void *p, u32 *blockheight);
#endif /* LIGHTNING_GOSSIPD_GOSSIPD_WIREGEN_H */
// SHA256STAMP:4aa62af856e3554603b0038eb0c9c6f5623cdb8d17abb6650338d1b728babd4b
// SHA256STAMP:9ac18b60ff39a11d7871d17a660aa9661a49d2585abe25d0ba0e048c32ac02eb

2
gossipd/queries.c

@ -15,7 +15,7 @@
#include <gossipd/queries.h>
#include <gossipd/routing.h>
#include <gossipd/seeker.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#include <wire/wire.h>
#include <zlib.h>

2
gossipd/routing.c

@ -21,7 +21,7 @@
#include <gossipd/gossipd_peerd_wiregen.h>
#include <gossipd/gossipd_wiregen.h>
#include <inttypes.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#ifndef SUPERVERBOSE
#define SUPERVERBOSE(...)

2
gossipd/routing.h

@ -11,7 +11,7 @@
#include <common/node_id.h>
#include <gossipd/broadcast.h>
#include <gossipd/gossip_store.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
#include <wire/wire.h>
struct daemon;

2
gossipd/seeker.c

@ -17,7 +17,7 @@
#include <gossipd/queries.h>
#include <gossipd/routing.h>
#include <gossipd/seeker.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#define GOSSIP_SEEKER_INTERVAL(seeker) \
DEV_FAST_GOSSIP((seeker)->daemon->rstate->dev_fast_gossip, 5, 60)

2
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

2
hsmd/hsmd.c

@ -51,7 +51,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <wally_bip32.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#include <wire/wire_io.h>
/*~ Each subdaemon is started with stdin connected to lightningd (for status

2
lightningd/connect_control.c

@ -27,7 +27,7 @@
#include <lightningd/opening_control.h>
#include <lightningd/peer_control.h>
#include <lightningd/subd.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#include <wire/wire_sync.h>
struct connect {

2
lightningd/gossip_control.c

@ -33,7 +33,7 @@
#include <lightningd/ping.h>
#include <sodium/randombytes.h>
#include <string.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
#include <wire/wire_sync.h>
static void got_txout(struct bitcoind *bitcoind,

2
lightningd/htlc_end.h

@ -7,7 +7,7 @@
#include <common/amount.h>
#include <common/htlc_state.h>
#include <common/sphinx.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
/* We look up HTLCs by channel & id */
struct htlc_key {

2
lightningd/htlc_set.h

@ -7,7 +7,7 @@
#include <common/amount.h>
#include <common/pseudorand.h>
#include <common/utils.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
struct htlc_in;
struct lightningd;

2
lightningd/invoice.h

@ -1,7 +1,7 @@
#ifndef LIGHTNING_LIGHTNINGD_INVOICE_H
#define LIGHTNING_LIGHTNINGD_INVOICE_H
#include "config.h"
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
struct amount_msat;
struct htlc_set;

2
lightningd/notification.h

@ -17,7 +17,7 @@
#include <lightningd/pay.h>
#include <lightningd/plugin.h>
#include <wallet/wallet.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
struct onionreply;

2
lightningd/peer_control.c

@ -58,7 +58,7 @@
#include <unistd.h>
#include <wally_bip32.h>
#include <wire/common_wiregen.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
#include <wire/wire_sync.h>
struct close_command {

2
lightningd/peer_htlcs.c

@ -36,7 +36,7 @@
#include <lightningd/subd.h>
#include <onchaind/onchaind_wiregen.h>
#include <wallet/wallet.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
#include <wire/wire_sync.h>
#ifndef SUPERVERBOSE

1
openingd/openingd.c

@ -52,7 +52,6 @@
#include <wally_bip32.h>
#include <wire/common_wiregen.h>
#include <wire/peer_wire.h>
#include <wire/peer_wiregen.h>
#include <wire/wire.h>
#include <wire/wire_sync.h>

4
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)

2
plugins/keysend.c

@ -3,7 +3,7 @@
#include <ccan/tal/str/str.h>
#include <plugins/libplugin-pay.h>
#include <plugins/libplugin.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
#define PREIMAGE_TLV_TYPE 5482373484
#define KEYSEND_FEATUREBIT 55

2
plugins/libplugin-pay.h

@ -4,7 +4,7 @@
#include <common/bolt11.h>
#include <plugins/libplugin.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
struct legacy_payload {
struct short_channel_id scid;

2
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)

2
wallet/wallet.h

@ -20,7 +20,7 @@
#include <lightningd/log.h>
#include <onchaind/onchaind_wire.h>
#include <wally_bip32.h>
#include <wire/onion_wiregen.h>
#include <wire/onion_wire.h>
struct amount_msat;
struct invoices;

37
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:

12
wire/onion_wire.h

@ -0,0 +1,12 @@
#ifndef LIGHTNING_WIRE_ONION_WIRE_H
#define LIGHTNING_WIRE_ONION_WIRE_H
#include "config.h"
#include <stdbool.h>
#if EXPERIMENTAL_FEATURES
#include <wire/onion_exp_wiregen.h>
#else
#include <wire/onion_wiregen.h>
#endif
#endif /* LIGHTNING_WIRE_ONION_WIRE_H */

0
wire/extracted_onion_wire_csv → wire/onion_wire_csv

5
wire/peer_wire.h

@ -2,7 +2,12 @@
#define LIGHTNING_WIRE_PEER_WIRE_H
#include "config.h"
#include <stdbool.h>
#if EXPERIMENTAL_FEATURES
#include <wire/peer_exp_wiregen.h>
#else
#include <wire/peer_wiregen.h>
#endif
/* BOLT #1:
*

0
wire/extracted_peer_wire_csv → wire/peer_wire_csv

2
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

2
wire/test/run-peer-wire.c

@ -14,7 +14,7 @@
#include <common/bigsize.h>
#include <bitcoin/chainparams.h>
#include <common/sphinx.h>
#include <wire/peer_wiregen.h>
#include <wire/peer_wire.h>
extern secp256k1_context *secp256k1_ctx;

4
wire/test/run-tlvstream.c

@ -13,7 +13,11 @@ static const char *reason;
#include <common/bigsize.c>
#include <common/node_id.c>
#if EXPERIMENTAL_FEATURES
#include <wire/peer_exp_wiregen.c>
#else
#include <wire/peer_wiregen.c>
#endif
#include <wire/fromwire.c>
#include <wire/towire.c>

Loading…
Cancel
Save