diff --git a/Makefile b/Makefile index 04f2f3a262e2..10eabbc27737 100644 --- a/Makefile +++ b/Makefile @@ -361,8 +361,8 @@ endif include external/Makefile include bitcoin/Makefile -include common/Makefile include wire/Makefile +include common/Makefile include db/Makefile include hsmd/Makefile include gossipd/Makefile @@ -383,10 +383,7 @@ include cln-grpc/Makefile endif include plugins/Makefile include tests/plugins/Makefile - -ifneq ($(FUZZING),0) - include tests/fuzz/Makefile -endif +include tests/fuzz/Makefile ifneq ($V,1) MSGGEN_ARGS := -s @@ -689,18 +686,22 @@ $(ALL_TEST_PROGRAMS) $(ALL_FUZZ_TARGETS): %: %.o # Without this rule, the (built-in) link line contains # external/libwallycore.a directly, which causes a symbol clash (it # uses some ccan modules internally). We want to rely on -lwallycore etc. -# (as per EXTERNAL_LDLIBS) so we filter them out here. +# (as per EXTERNAL_LDLIBS) so we filter them out here. We have to put the other +# .a files (if any) at the end of the link line. $(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS): - @$(call VERBOSE, "ld $@", $(LINK.o) $(filter-out %.a,$^) $(LOADLIBES) $(EXTERNAL_LDLIBS) $(LDLIBS) libccan.a $($(@)_LDLIBS) -o $@) + @$(call VERBOSE, "ld $@", $(LINK.o) $(filter-out %.a,$^) $(filter-out external/%,$(filter %.a,$^)) $(LOADLIBES) $(EXTERNAL_LDLIBS) $(LDLIBS) $($(@)_LDLIBS) -o $@) ifeq ($(OS),Darwin) @$(call VERBOSE, "dsymutil $@", dsymutil $@) endif # We special case the fuzzing target binaries, as they need to link against libfuzzer, # which brings its own main(). +ifneq ($(FUZZING),0) FUZZ_LDFLAGS = -fsanitize=fuzzer +endif + $(ALL_FUZZ_TARGETS): - @$(call VERBOSE, "ld $@", $(LINK.o) $(filter-out %.a,$^) $(LOADLIBES) $(EXTERNAL_LDLIBS) $(LDLIBS) libccan.a $(FUZZ_LDFLAGS) -o $@) + @$(call VERBOSE, "ld $@", $(LINK.o) $(filter-out %.a,$^) libcommon.a libccan.a $(LOADLIBES) $(EXTERNAL_LDLIBS) $(LDLIBS) $(FUZZ_LDFLAGS) -o $@) ifeq ($(OS),Darwin) @$(call VERBOSE, "dsymutil $@", dsymutil $@) endif @@ -1074,3 +1075,8 @@ ccan-rune-rune.o: $(CCANDIR)/ccan/rune/rune.c @$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<) ccan-rune-coding.o: $(CCANDIR)/ccan/rune/coding.c @$(call VERBOSE, "cc $<", $(CC) $(CFLAGS) -c -o $@ $<) + +print-binary-sizes: $(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS) + @find $(ALL_PROGRAMS) $(ALL_TEST_PROGRAMS) -printf '%p\t%s\n' + @echo 'Total program size: '`find $(ALL_PROGRAMS) -printf '%s\n' | awk '{TOTAL+= $$1} END {print TOTAL}'` + @echo 'Total tests size: '`find $(ALL_TEST_PROGRAMS) -printf '%s\n' | awk '{TOTAL+= $$1} END {print TOTAL}'` diff --git a/bitcoin/Makefile b/bitcoin/Makefile index df2dc04b0927..0f42a2535613 100644 --- a/bitcoin/Makefile +++ b/bitcoin/Makefile @@ -38,9 +38,6 @@ BITCOIN_HEADERS := bitcoin/address.h \ bitcoin/tx_parts.h \ bitcoin/varint.h -# Bitcoin objects depends on bitcoin/ external/ and ccan -$(BITCOIN_OBJS): $(CCAN_HEADERS) $(BITCOIN_HEADERS) $(EXTERNAL_HEADERS) - ALL_C_HEADERS += $(BITCOIN_HEADERS) ALL_C_SOURCES += $(BITCOIN_SRC) diff --git a/bitcoin/base58.c b/bitcoin/base58.c index a3da473a9690..f0dc2a78d7bf 100644 --- a/bitcoin/base58.c +++ b/bitcoin/base58.c @@ -6,9 +6,6 @@ #include "config.h" #include #include -#include -#include -#include #include #include diff --git a/bitcoin/block.c b/bitcoin/block.c index 53fc6d9d76c4..5a36a7dfc890 100644 --- a/bitcoin/block.c +++ b/bitcoin/block.c @@ -1,7 +1,6 @@ #include "config.h" #include #include -#include #include #include #include diff --git a/bitcoin/block.h b/bitcoin/block.h index a2631b732f12..a3289ee7cc14 100644 --- a/bitcoin/block.h +++ b/bitcoin/block.h @@ -4,7 +4,6 @@ #include "bitcoin/shadouble.h" #include #include -#include struct chainparams; diff --git a/bitcoin/chainparams.c b/bitcoin/chainparams.c index 572f8b16747e..9d2883ba1def 100644 --- a/bitcoin/chainparams.c +++ b/bitcoin/chainparams.c @@ -3,7 +3,6 @@ #include #include #include -#include /* Version codes for BIP32 extended keys in libwally-core. * Stolen from wally_bip32.h in libwally-core*/ diff --git a/bitcoin/feerate.h b/bitcoin/feerate.h index cab1e95e258c..f4dbdbbd672c 100644 --- a/bitcoin/feerate.h +++ b/bitcoin/feerate.h @@ -2,7 +2,6 @@ #define LIGHTNING_BITCOIN_FEERATE_H #include "config.h" #include -#include #include /* bitcoind considers 250 satoshi per kw to be the minimum acceptable fee: diff --git a/bitcoin/locktime.c b/bitcoin/locktime.c index f73559dc1447..d45e8caeaf64 100644 --- a/bitcoin/locktime.c +++ b/bitcoin/locktime.c @@ -1,7 +1,6 @@ #include "config.h" #include #include -#include #define SECONDS_POINT 500000000 diff --git a/bitcoin/privkey.h b/bitcoin/privkey.h index d592d4685501..b4ee358415c4 100644 --- a/bitcoin/privkey.h +++ b/bitcoin/privkey.h @@ -2,7 +2,6 @@ #define LIGHTNING_BITCOIN_PRIVKEY_H #include "config.h" #include -#include #include #define PRIVKEY_LEN 32 diff --git a/bitcoin/psbt.c b/bitcoin/psbt.c index dff12b040fad..ea4a6c2f3307 100644 --- a/bitcoin/psbt.c +++ b/bitcoin/psbt.c @@ -1,13 +1,10 @@ #include "config.h" #include -#include #include #include #include -#include #include #include -#include #include #include #include diff --git a/bitcoin/script.c b/bitcoin/script.c index 63974644a34c..73367f5bc610 100644 --- a/bitcoin/script.c +++ b/bitcoin/script.c @@ -5,10 +5,10 @@ #include #include #include -#include #include #include #include +#include /* To push 0-75 bytes onto stack. */ #define OP_PUSHBYTES(val) (val) diff --git a/bitcoin/script.h b/bitcoin/script.h index 5b96d696ff15..ccbad3bfe28a 100644 --- a/bitcoin/script.h +++ b/bitcoin/script.h @@ -3,7 +3,6 @@ #include "config.h" #include "signature.h" #include "tx.h" -#include struct bitcoin_address; struct preimage; diff --git a/bitcoin/short_channel_id.h b/bitcoin/short_channel_id.h index 1cd13f9a4cff..3c7cce9036bc 100644 --- a/bitcoin/short_channel_id.h +++ b/bitcoin/short_channel_id.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_BITCOIN_SHORT_CHANNEL_ID_H #define LIGHTNING_BITCOIN_SHORT_CHANNEL_ID_H #include "config.h" -#include #include #include #include diff --git a/bitcoin/signature.c b/bitcoin/signature.c index 82215cf2cf2c..5ae7bd555a6b 100644 --- a/bitcoin/signature.c +++ b/bitcoin/signature.c @@ -3,8 +3,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/bitcoin/test/Makefile b/bitcoin/test/Makefile index 7b15ab9ae07f..eadb3ed3585b 100644 --- a/bitcoin/test/Makefile +++ b/bitcoin/test/Makefile @@ -2,10 +2,8 @@ BITCOIN_TEST_SRC := $(wildcard bitcoin/test/run-*.c) BITCOIN_TEST_OBJS := $(BITCOIN_TEST_SRC:.c=.o) BITCOIN_TEST_PROGRAMS := $(BITCOIN_TEST_OBJS:.o=) -BITCOIN_TEST_COMMON_OBJS := common/utils.o common/setup.o common/autodata.o - -$(BITCOIN_TEST_PROGRAMS): $(BITCOIN_TEST_COMMON_OBJS) bitcoin/chainparams.o -$(BITCOIN_TEST_OBJS): $(CCAN_HEADERS) $(BITCOIN_HEADERS) $(BITCOIN_SRC) +$(BITCOIN_TEST_PROGRAMS): bitcoin/chainparams.o libcommon.a +$(BITCOIN_TEST_OBJS): $(BITCOIN_HEADERS) $(BITCOIN_SRC) bitcoin/test/Makefile ALL_TEST_PROGRAMS += $(BITCOIN_TEST_PROGRAMS) ALL_C_SOURCES += $(BITCOIN_TEST_PROGRAMS:=.c) diff --git a/bitcoin/test/run-bitcoin_block_from_hex.c b/bitcoin/test/run-bitcoin_block_from_hex.c index 5f6bb9bb7bfc..0dc0bd640fc8 100644 --- a/bitcoin/test/run-bitcoin_block_from_hex.c +++ b/bitcoin/test/run-bitcoin_block_from_hex.c @@ -10,93 +10,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for fromwire */ -const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) -{ fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_fail */ -void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_fail called!\n"); abort(); } -/* Generated stub for fromwire_secp256k1_ecdsa_signature */ -void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "fromwire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for fromwire_sha256 */ -void fromwire_sha256(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "fromwire_sha256 called!\n"); abort(); } -/* Generated stub for fromwire_u32 */ -u32 fromwire_u32(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u32 called!\n"); abort(); } -/* Generated stub for fromwire_u8 */ -u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u8 called!\n"); abort(); } -/* Generated stub for fromwire_u8_array */ -void fromwire_u8_array(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_u8_array called!\n"); abort(); } -/* Generated stub for is_anchor_witness_script */ -bool is_anchor_witness_script(const u8 *script UNNEEDED, size_t script_len UNNEEDED) -{ fprintf(stderr, "is_anchor_witness_script called!\n"); abort(); } -/* Generated stub for is_to_remote_anchored_witness_script */ -bool is_to_remote_anchored_witness_script(const u8 *script UNNEEDED, size_t script_len UNNEEDED) -{ fprintf(stderr, "is_to_remote_anchored_witness_script called!\n"); abort(); } -/* Generated stub for pubkey_to_der */ -void pubkey_to_der(u8 der[PUBKEY_CMPR_LEN] UNNEEDED, const struct pubkey *key UNNEEDED) -{ fprintf(stderr, "pubkey_to_der called!\n"); abort(); } -/* Generated stub for pubkey_to_hash160 */ -void pubkey_to_hash160(const struct pubkey *pk UNNEEDED, struct ripemd160 *hash UNNEEDED) -{ fprintf(stderr, "pubkey_to_hash160 called!\n"); abort(); } -/* Generated stub for scriptpubkey_p2wsh */ -u8 *scriptpubkey_p2wsh(const tal_t *ctx UNNEEDED, const u8 *witnessscript UNNEEDED) -{ fprintf(stderr, "scriptpubkey_p2wsh called!\n"); abort(); } -/* Generated stub for towire_secp256k1_ecdsa_signature */ -void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED, - const secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "towire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for towire_sha256 */ -void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "towire_sha256 called!\n"); abort(); } -/* Generated stub for towire_u32 */ -void towire_u32(u8 **pptr UNNEEDED, u32 v UNNEEDED) -{ fprintf(stderr, "towire_u32 called!\n"); abort(); } -/* Generated stub for towire_u8 */ -void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) -{ fprintf(stderr, "towire_u8 called!\n"); abort(); } -/* Generated stub for towire_u8_array */ -void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "towire_u8_array called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ static const char block[] = diff --git a/bitcoin/test/run-psbt-from-tx.c b/bitcoin/test/run-psbt-from-tx.c index 2b55c420b0a2..5af07b3c92f9 100644 --- a/bitcoin/test/run-psbt-from-tx.c +++ b/bitcoin/test/run-psbt-from-tx.c @@ -9,77 +9,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for fromwire_sha256_double */ -void fromwire_sha256_double(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - struct sha256_double *sha256d UNNEEDED) -{ fprintf(stderr, "fromwire_sha256_double called!\n"); abort(); } -/* Generated stub for is_anchor_witness_script */ -bool is_anchor_witness_script(const u8 *script UNNEEDED, size_t script_len UNNEEDED) -{ fprintf(stderr, "is_anchor_witness_script called!\n"); abort(); } -/* Generated stub for is_to_remote_anchored_witness_script */ -bool is_to_remote_anchored_witness_script(const u8 *script UNNEEDED, size_t script_len UNNEEDED) -{ fprintf(stderr, "is_to_remote_anchored_witness_script called!\n"); abort(); } -/* Generated stub for pubkey_to_der */ -void pubkey_to_der(u8 der[PUBKEY_CMPR_LEN] UNNEEDED, const struct pubkey *key UNNEEDED) -{ fprintf(stderr, "pubkey_to_der called!\n"); abort(); } -/* Generated stub for pubkey_to_hash160 */ -void pubkey_to_hash160(const struct pubkey *pk UNNEEDED, struct ripemd160 *hash UNNEEDED) -{ fprintf(stderr, "pubkey_to_hash160 called!\n"); abort(); } -/* Generated stub for scriptpubkey_p2wsh */ -u8 *scriptpubkey_p2wsh(const tal_t *ctx UNNEEDED, const u8 *witnessscript UNNEEDED) -{ fprintf(stderr, "scriptpubkey_p2wsh called!\n"); abort(); } -/* Generated stub for sha256_double */ -void sha256_double(struct sha256_double *shadouble UNNEEDED, const void *p UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "sha256_double called!\n"); abort(); } -/* Generated stub for signature_from_der */ -bool signature_from_der(const u8 *der UNNEEDED, size_t len UNNEEDED, struct bitcoin_signature *sig UNNEEDED) -{ fprintf(stderr, "signature_from_der called!\n"); abort(); } -/* Generated stub for signature_to_der */ -size_t signature_to_der(u8 der[73] UNNEEDED, const struct bitcoin_signature *sig UNNEEDED) -{ fprintf(stderr, "signature_to_der called!\n"); abort(); } -/* Generated stub for towire_sha256_double */ -void towire_sha256_double(u8 **pptr UNNEEDED, const struct sha256_double *sha256d UNNEEDED) -{ fprintf(stderr, "towire_sha256_double called!\n"); abort(); } -/* Generated stub for varint_put */ -size_t varint_put(u8 buf[VARINT_MAX_LEN] UNNEEDED, varint_t v UNNEEDED) -{ fprintf(stderr, "varint_put called!\n"); abort(); } -/* Generated stub for varint_size */ -size_t varint_size(varint_t v UNNEEDED) -{ fprintf(stderr, "varint_size called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ /* This transaction has scriptSig data in it. diff --git a/bitcoin/test/run-secret_eq_consttime.c b/bitcoin/test/run-secret_eq_consttime.c index 4f21ee191f11..6d4cb414197c 100644 --- a/bitcoin/test/run-secret_eq_consttime.c +++ b/bitcoin/test/run-secret_eq_consttime.c @@ -8,12 +8,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for fromwire */ -const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) -{ fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for towire */ -void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "towire called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ static bool verbose = false; diff --git a/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c b/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c index feb3817e1727..47be0d72643e 100644 --- a/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c +++ b/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c @@ -13,116 +13,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for clone_psbt */ -struct wally_psbt *clone_psbt(const tal_t *ctx UNNEEDED, const struct wally_psbt *psbt UNNEEDED) -{ fprintf(stderr, "clone_psbt called!\n"); abort(); } -/* Generated stub for fromwire */ -const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) -{ fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_fail */ -void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_fail called!\n"); abort(); } -/* Generated stub for fromwire_secp256k1_ecdsa_signature */ -void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "fromwire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for fromwire_sha256 */ -void fromwire_sha256(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "fromwire_sha256 called!\n"); abort(); } -/* Generated stub for fromwire_u32 */ -u32 fromwire_u32(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u32 called!\n"); abort(); } -/* Generated stub for fromwire_u8 */ -u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u8 called!\n"); abort(); } -/* Generated stub for fromwire_u8_array */ -void fromwire_u8_array(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_u8_array called!\n"); abort(); } -/* Generated stub for fromwire_wally_psbt */ -struct wally_psbt *fromwire_wally_psbt(const tal_t *ctx UNNEEDED, - const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_wally_psbt called!\n"); abort(); } -/* Generated stub for new_psbt */ -struct wally_psbt *new_psbt(const tal_t *ctx UNNEEDED, - const struct wally_tx *wtx UNNEEDED) -{ fprintf(stderr, "new_psbt called!\n"); abort(); } -/* Generated stub for psbt_add_output */ -struct wally_psbt_output *psbt_add_output(struct wally_psbt *psbt UNNEEDED, - struct wally_tx_output *output UNNEEDED, - size_t insert_at UNNEEDED) -{ fprintf(stderr, "psbt_add_output called!\n"); abort(); } -/* Generated stub for psbt_append_input */ -struct wally_psbt_input *psbt_append_input(struct wally_psbt *psbt UNNEEDED, - const struct bitcoin_outpoint *outpoint UNNEEDED, - u32 sequence UNNEEDED, - const u8 *scriptSig UNNEEDED, - const u8 *input_wscript UNNEEDED, - const u8 *redeemscript UNNEEDED) -{ fprintf(stderr, "psbt_append_input called!\n"); abort(); } -/* Generated stub for psbt_final_tx */ -struct wally_tx *psbt_final_tx(const tal_t *ctx UNNEEDED, const struct wally_psbt *psbt UNNEEDED) -{ fprintf(stderr, "psbt_final_tx called!\n"); abort(); } -/* Generated stub for psbt_finalize */ -bool psbt_finalize(struct wally_psbt *psbt UNNEEDED) -{ fprintf(stderr, "psbt_finalize called!\n"); abort(); } -/* Generated stub for psbt_input_get_amount */ -struct amount_sat psbt_input_get_amount(const struct wally_psbt *psbt UNNEEDED, - size_t in UNNEEDED) -{ fprintf(stderr, "psbt_input_get_amount called!\n"); abort(); } -/* Generated stub for psbt_input_set_wit_utxo */ -void psbt_input_set_wit_utxo(struct wally_psbt *psbt UNNEEDED, size_t in UNNEEDED, - const u8 *scriptPubkey UNNEEDED, struct amount_sat amt UNNEEDED) -{ fprintf(stderr, "psbt_input_set_wit_utxo called!\n"); abort(); } -/* Generated stub for towire */ -void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_secp256k1_ecdsa_signature */ -void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED, - const secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "towire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for towire_sha256 */ -void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "towire_sha256 called!\n"); abort(); } -/* Generated stub for towire_u32 */ -void towire_u32(u8 **pptr UNNEEDED, u32 v UNNEEDED) -{ fprintf(stderr, "towire_u32 called!\n"); abort(); } -/* Generated stub for towire_u8 */ -void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) -{ fprintf(stderr, "towire_u8 called!\n"); abort(); } -/* Generated stub for towire_u8_array */ -void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "towire_u8_array called!\n"); abort(); } -/* Generated stub for towire_wally_psbt */ -void towire_wally_psbt(u8 **pptr UNNEEDED, const struct wally_psbt *psbt UNNEEDED) -{ fprintf(stderr, "towire_wally_psbt called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, const char *argv[]) diff --git a/bitcoin/test/run-tx-encode.c b/bitcoin/test/run-tx-encode.c index b28f3191c00c..404862fec1dd 100644 --- a/bitcoin/test/run-tx-encode.c +++ b/bitcoin/test/run-tx-encode.c @@ -11,93 +11,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for fromwire */ -const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) -{ fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_fail */ -void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_fail called!\n"); abort(); } -/* Generated stub for fromwire_secp256k1_ecdsa_signature */ -void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "fromwire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for fromwire_sha256 */ -void fromwire_sha256(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "fromwire_sha256 called!\n"); abort(); } -/* Generated stub for fromwire_u32 */ -u32 fromwire_u32(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u32 called!\n"); abort(); } -/* Generated stub for fromwire_u8 */ -u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u8 called!\n"); abort(); } -/* Generated stub for fromwire_u8_array */ -void fromwire_u8_array(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_u8_array called!\n"); abort(); } -/* Generated stub for is_anchor_witness_script */ -bool is_anchor_witness_script(const u8 *script UNNEEDED, size_t script_len UNNEEDED) -{ fprintf(stderr, "is_anchor_witness_script called!\n"); abort(); } -/* Generated stub for is_to_remote_anchored_witness_script */ -bool is_to_remote_anchored_witness_script(const u8 *script UNNEEDED, size_t script_len UNNEEDED) -{ fprintf(stderr, "is_to_remote_anchored_witness_script called!\n"); abort(); } -/* Generated stub for pubkey_to_der */ -void pubkey_to_der(u8 der[PUBKEY_CMPR_LEN] UNNEEDED, const struct pubkey *key UNNEEDED) -{ fprintf(stderr, "pubkey_to_der called!\n"); abort(); } -/* Generated stub for pubkey_to_hash160 */ -void pubkey_to_hash160(const struct pubkey *pk UNNEEDED, struct ripemd160 *hash UNNEEDED) -{ fprintf(stderr, "pubkey_to_hash160 called!\n"); abort(); } -/* Generated stub for scriptpubkey_p2wsh */ -u8 *scriptpubkey_p2wsh(const tal_t *ctx UNNEEDED, const u8 *witnessscript UNNEEDED) -{ fprintf(stderr, "scriptpubkey_p2wsh called!\n"); abort(); } -/* Generated stub for towire_secp256k1_ecdsa_signature */ -void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED, - const secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "towire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for towire_sha256 */ -void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "towire_sha256 called!\n"); abort(); } -/* Generated stub for towire_u32 */ -void towire_u32(u8 **pptr UNNEEDED, u32 v UNNEEDED) -{ fprintf(stderr, "towire_u32 called!\n"); abort(); } -/* Generated stub for towire_u8 */ -void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) -{ fprintf(stderr, "towire_u8 called!\n"); abort(); } -/* Generated stub for towire_u8_array */ -void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "towire_u8_array called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ const char extended_tx[] = diff --git a/bitcoin/tx.h b/bitcoin/tx.h index 2549cd5e2b61..4b7134e0f8c2 100644 --- a/bitcoin/tx.h +++ b/bitcoin/tx.h @@ -2,11 +2,7 @@ #define LIGHTNING_BITCOIN_TX_H #include "config.h" #include -#include -#include #include -#include -#include #include #define BITCOIN_TX_DEFAULT_SEQUENCE 0xFFFFFFFF diff --git a/channeld/Makefile b/channeld/Makefile index 7edcd460ae4d..a2c11e8bdda7 100644 --- a/channeld/Makefile +++ b/channeld/Makefile @@ -34,73 +34,9 @@ LIGHTNINGD_CONTROL_OBJS += \ channeld/channeld_wiregen.o \ channeld/inflight.o - -# Common source we use. -CHANNELD_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/bigsize.o \ - common/billboard.o \ - common/bip32.o \ - common/blinding.o \ - common/blockheight_states.o \ - common/channel_config.o \ - common/channel_id.o \ - common/channel_type.o \ - common/cryptomsg.o \ - common/daemon.o \ - common/daemon_conn.o \ - common/derive_basepoints.o \ - common/ecdh_hsmd.o \ - common/features.o \ - common/fee_states.o \ - common/peer_io.o \ - common/peer_status_wiregen.o \ - common/status_wiregen.o \ - common/gossip_store.o \ - common/hmac.o \ - common/hsm_capable.o \ - common/interactivetx.o \ - common/htlc_state.o \ - common/htlc_trim.o \ - common/htlc_tx.o \ - common/htlc_wire.o \ - common/initial_channel.o \ - common/initial_commit_tx.o \ - common/keyset.o \ - common/key_derive.o \ - common/memleak.o \ - common/msg_queue.o \ - common/node_id.o \ - common/onionreply.o \ - common/peer_billboard.o \ - common/peer_failed.o \ - common/penalty_base.o \ - common/per_peer_state.o \ - common/permute_tx.o \ - common/ping.o \ - common/psbt_keypath.o \ - common/psbt_open.o \ - common/psbt_internal.o \ - common/pseudorand.o \ - common/read_peer_msg.o \ - common/setup.o \ - common/status.o \ - common/status_wire.o \ - common/subdaemon.o \ - common/timeout.o \ - common/utils.o \ - common/utxo.o \ - common/version.o \ - common/wire_error.o \ - common/wireaddr.o \ - wire/fromwire.o \ - wire/towire.o - channeld/full_channel_error_names_gen.h: channeld/full_channel_error.h ccan/ccan/cdump/tools/cdump-enumstr ccan/ccan/cdump/tools/cdump-enumstr channeld/full_channel_error.h > $@ -lightningd/lightning_channeld: $(CHANNELD_OBJS) $(CHANNELD_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(HSMD_CLIENT_OBJS) +lightningd/lightning_channeld: $(CHANNELD_OBJS) $(HSMD_CLIENT_OBJS) libcommon.a include channeld/test/Makefile diff --git a/channeld/channeld.c b/channeld/channeld.c index eb1b7a50315d..6489ba7c6d0a 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -19,14 +19,10 @@ #include #include #include -#include #include #include #include #include -#include -#include -#include #include #include #include @@ -42,14 +38,12 @@ #include #include #include +#include #include #include #include #include -#include -#include -#include -#include +#include #include /* stdin == requests, 3 == peer, 4 = HSM */ diff --git a/channeld/channeld.h b/channeld/channeld.h index a2b26b08246a..c57a2902e0cd 100644 --- a/channeld/channeld.h +++ b/channeld/channeld.h @@ -2,7 +2,6 @@ #define LIGHTNING_CHANNELD_CHANNELD_H #include "config.h" #include -#include #include const u8 *hsm_req(const tal_t *ctx, const u8 *req TAKES); diff --git a/channeld/channeld_htlc.h b/channeld/channeld_htlc.h index 14d41f07ab71..2bd7075c2536 100644 --- a/channeld/channeld_htlc.h +++ b/channeld/channeld_htlc.h @@ -1,11 +1,8 @@ #ifndef LIGHTNING_CHANNELD_CHANNELD_HTLC_H #define LIGHTNING_CHANNELD_CHANNELD_HTLC_H #include "config.h" -#include #include #include -#include -#include struct htlc { /* What's the status. */ diff --git a/channeld/full_channel.c b/channeld/full_channel.c index 699ccdf40ca4..9bf383dbc8ac 100644 --- a/channeld/full_channel.c +++ b/channeld/full_channel.c @@ -13,6 +13,7 @@ #include #include #include +#include #include /* Needs to be at end, since it doesn't include its own hdrs */ #include "full_channel_error_names_gen.h" diff --git a/channeld/inflight.c b/channeld/inflight.c index db84e58196a8..475e6698fdec 100644 --- a/channeld/inflight.c +++ b/channeld/inflight.c @@ -1,5 +1,4 @@ #include "config.h" -#include #include #include #include diff --git a/channeld/inflight.h b/channeld/inflight.h index 7143e0ad9ae6..025dc450240d 100644 --- a/channeld/inflight.h +++ b/channeld/inflight.h @@ -3,6 +3,7 @@ #include "config.h" #include +#include #include #include diff --git a/channeld/splice.c b/channeld/splice.c index e72b4af54830..6ebc73df1aae 100644 --- a/channeld/splice.c +++ b/channeld/splice.c @@ -1,5 +1,4 @@ #include "config.h" -#include #include struct splice_state *splice_state_new(const tal_t *ctx) diff --git a/channeld/test/Makefile b/channeld/test/Makefile index 67bc5a79769f..0bb50c47ab6c 100644 --- a/channeld/test/Makefile +++ b/channeld/test/Makefile @@ -7,7 +7,13 @@ CHANNELD_TEST_PROGRAMS := $(CHANNELD_TEST_OBJS:.o=) ALL_C_SOURCES += $(CHANNELD_TEST_SRC) ALL_TEST_PROGRAMS += $(CHANNELD_TEST_PROGRAMS) -CHANNELD_TEST_COMMON_OBJS := \ +# run-full_channel.o needs a special version of some common files! +$(filter-out channeld/test/run-full_channel,$(CHANNELD_TEST_PROGRAMS)): libcommon.a + +channeld/test/run-full_channel: \ + $(BITCOIN_OBJS) \ + wire/towire.o \ + wire/fromwire.o \ common/amount.o \ common/autodata.o \ common/channel_type.o \ @@ -24,8 +30,6 @@ CHANNELD_TEST_COMMON_OBJS := \ common/setup.o \ common/utils.o -$(CHANNELD_TEST_PROGRAMS): $(BITCOIN_OBJS) $(WIRE_OBJS) $(CHANNELD_TEST_COMMON_OBJS) - -$(CHANNELD_TEST_OBJS): $(CHANNELD_HEADERS) $(CHANNELD_SRC) +$(CHANNELD_TEST_OBJS): $(CHANNELD_HEADERS) $(CHANNELD_SRC) channeld/test/Makefile check-units: $(CHANNELD_TEST_PROGRAMS:%=unittest/%) diff --git a/channeld/test/run-commit_tx.c b/channeld/test/run-commit_tx.c index 5f0a636bdd4b..b57e50a36cc8 100644 --- a/channeld/test/run-commit_tx.c +++ b/channeld/test/run-commit_tx.c @@ -9,6 +9,7 @@ static bool print_superverbose; #define PRINT_ACTUAL_FEE #include "../commit_tx.c" #include +#include #include #include #include @@ -22,37 +23,6 @@ static bool print_superverbose; /*#define DEBUG */ /* AUTOGENERATED MOCKS START */ -/* Generated stub for fromwire_bigsize */ -bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_bigsize called!\n"); abort(); } -/* Generated stub for fromwire_channel_id */ -bool 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_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 pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace called!\n"); abort(); } -/* Generated stub for status_fmt */ -void status_fmt(enum log_level level UNNEEDED, - const struct node_id *peer UNNEEDED, - const char *fmt UNNEEDED, ...) - -{ fprintf(stderr, "status_fmt 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_node_id */ -void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "towire_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ /* bitcoind loves its backwards txids! */ diff --git a/channeld/test/run-full_channel.c b/channeld/test/run-full_channel.c index 69128019418e..a852d19279fa 100644 --- a/channeld/test/run-full_channel.c +++ b/channeld/test/run-full_channel.c @@ -9,25 +9,32 @@ #include "../full_channel.c" #include "../commit_tx.c" #include +#include #include #include +#include +#include /* AUTOGENERATED MOCKS START */ -/* Generated stub for fromwire_bigsize */ -bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_bigsize 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(); } +/* Generated stub for io_read_wire_ */ +struct io_plan *io_read_wire_(struct io_conn *conn UNNEEDED, + const tal_t *ctx UNNEEDED, + u8 **data UNNEEDED, + struct io_plan *(*next)(struct io_conn * UNNEEDED, void *) UNNEEDED, + void *next_arg UNNEEDED) +{ fprintf(stderr, "io_read_wire_ called!\n"); abort(); } +/* Generated stub for io_write_wire_ */ +struct io_plan *io_write_wire_(struct io_conn *conn UNNEEDED, + const u8 *data TAKES UNNEEDED, + struct io_plan *(*next)(struct io_conn * UNNEEDED, void *) UNNEEDED, + void *next_arg UNNEEDED) +{ fprintf(stderr, "io_write_wire_ called!\n"); abort(); } /* Generated stub for memleak_add_helper_ */ void memleak_add_helper_(const tal_t *p UNNEEDED, void (*cb)(struct htable *memtable UNNEEDED, const tal_t *)){ } /* Generated stub for memleak_scan_htable */ void memleak_scan_htable(struct htable *memtable UNNEEDED, const struct htable *ht UNNEEDED) { fprintf(stderr, "memleak_scan_htable called!\n"); abort(); } -/* Generated stub for pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } /* Generated stub for send_backtrace */ void send_backtrace(const char *why UNNEEDED) { fprintf(stderr, "send_backtrace called!\n"); abort(); } @@ -35,12 +42,9 @@ void send_backtrace(const char *why UNNEEDED) void status_failed(enum status_failreason code UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "status_failed 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_node_id */ -void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "towire_node_id called!\n"); abort(); } +/* Generated stub for wire_sync_write */ +bool wire_sync_write(int fd UNNEEDED, const void *msg TAKES UNNEEDED) +{ fprintf(stderr, "wire_sync_write called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ void status_fmt(enum log_level level UNUSED, diff --git a/channeld/watchtower.c b/channeld/watchtower.c index 43a267e84f10..285cdc460754 100644 --- a/channeld/watchtower.c +++ b/channeld/watchtower.c @@ -3,13 +3,11 @@ #include #include #include -#include #include #include #include #include #include -#include static const u8 ONE = 0x1; diff --git a/cli/Makefile b/cli/Makefile index 82dea907ea61..6442fd369132 100644 --- a/cli/Makefile +++ b/cli/Makefile @@ -5,17 +5,8 @@ ALL_C_SOURCES += $(LIGHTNING_CLI_SRC) ALL_C_HEADERS += ALL_PROGRAMS += cli/lightning-cli -LIGHTNING_CLI_COMMON_OBJS := \ - bitcoin/chainparams.o \ - common/configdir.o \ - common/configvar.o \ - common/json_parse_simple.o \ - common/status_levels.o \ - common/utils.o \ - common/version.o +$(LIGHTNING_CLI_OBJS): $(JSMN_HEADERS) cli/Makefile -$(LIGHTNING_CLI_OBJS): $(JSMN_HEADERS) $(COMMON_HEADERS) $(CCAN_HEADERS) - -cli/lightning-cli: $(LIGHTNING_CLI_OBJS) $(LIGHTNING_CLI_COMMON_OBJS) $(JSMN_OBJS) libccan.a +cli/lightning-cli: $(LIGHTNING_CLI_OBJS) libcommon.a include cli/test/Makefile diff --git a/cli/config_cli.h b/cli/config_cli.h index 6faeb3606992..5b0dcfd6cdf6 100644 --- a/cli/config_cli.h +++ b/cli/config_cli.h @@ -2,7 +2,6 @@ #define LIGHTNING_CLI_CONFIG_CLI_H #include "config.h" -#include #ifndef CLN_TEST /* Redefinition procedure is a very cool feature, but diff --git a/cli/lightning-cli.c b/cli/lightning-cli.c index 10f8fffc2d7b..3aed5362a662 100644 --- a/cli/lightning-cli.c +++ b/cli/lightning-cli.c @@ -13,14 +13,12 @@ #include #include #include -#include #include -#include #include +#include #include #include #include -#include #define NO_ERROR 0 #define ERROR_FROM_LIGHTNINGD 1 diff --git a/cli/test/Makefile b/cli/test/Makefile index 6f9c9bea6579..d6dcffb787ce 100644 --- a/cli/test/Makefile +++ b/cli/test/Makefile @@ -7,23 +7,8 @@ CLI_TEST_PROGRAMS := $(CLI_TEST_OBJS:.o=) ALL_C_SOURCES += $(CLI_TEST_SRC) ALL_TEST_PROGRAMS += $(CLI_TEST_PROGRAMS) -CLI_TEST_COMMON_OBJS := \ - common/autodata.o \ - common/configdir.o \ - common/configvar.o \ - common/daemon_conn.o \ - common/htlc_state.o \ - common/json_parse_simple.o \ - common/pseudorand.o \ - common/memleak.o \ - common/msg_queue.o \ - common/setup.o \ - common/utils.o \ - common/version.o \ - common/permute_tx.o +$(CLI_TEST_PROGRAMS): libcommon.a -$(CLI_TEST_PROGRAMS): libccan.a $(BITCOIN_OBJS) $(WIRE_OBJS) $(CLI_TEST_COMMON_OBJS) - -$(CLI_TEST_OBJS): $(LIGHTNING_CLI_HEADERS) $(LIGHTNING_CLI_SRC) +$(CLI_TEST_OBJS): $(LIGHTNING_CLI_HEADERS) $(LIGHTNING_CLI_SRC) cli/test/Makefile check-units: $(CLI_TEST_PROGRAMS:%=unittest/%) diff --git a/cli/test/run-human-mode.c b/cli/test/run-human-mode.c index 4f2af64e5f4a..c90c4d87685a 100644 --- a/cli/test/run-human-mode.c +++ b/cli/test/run-human-mode.c @@ -33,84 +33,6 @@ int test_chdir(const char *path); #undef main /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for fromwire_amount_msat */ -struct amount_msat fromwire_amount_msat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_amount_msat called!\n"); abort(); } -/* Generated stub for fromwire_amount_sat */ -struct amount_sat fromwire_amount_sat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_amount_sat 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(); } -/* Generated stub for fromwire_channel_id */ -bool 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_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 log_level_name */ -const char *log_level_name(enum log_level level UNNEEDED) -{ fprintf(stderr, "log_level_name called!\n"); abort(); } -/* Generated stub for log_level_parse */ -bool log_level_parse(const char *levelstr UNNEEDED, size_t len UNNEEDED, - enum log_level *level UNNEEDED) -{ fprintf(stderr, "log_level_parse called!\n"); abort(); } -/* Generated stub for pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace called!\n"); abort(); } -/* Generated stub for towire_amount_msat */ -void towire_amount_msat(u8 **pptr UNNEEDED, const struct amount_msat msat UNNEEDED) -{ fprintf(stderr, "towire_amount_msat called!\n"); abort(); } -/* Generated stub for towire_amount_sat */ -void towire_amount_sat(u8 **pptr UNNEEDED, const struct amount_sat sat UNNEEDED) -{ fprintf(stderr, "towire_amount_sat 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_node_id */ -void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "towire_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int test_socket(int domain UNUSED, int type UNUSED, int protocol UNUSED) diff --git a/cli/test/run-large-input.c b/cli/test/run-large-input.c index 3b8742d6c33b..c1dc929dd974 100644 --- a/cli/test/run-large-input.c +++ b/cli/test/run-large-input.c @@ -33,84 +33,6 @@ int test_chdir(const char *path); #undef main /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for fromwire_amount_msat */ -struct amount_msat fromwire_amount_msat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_amount_msat called!\n"); abort(); } -/* Generated stub for fromwire_amount_sat */ -struct amount_sat fromwire_amount_sat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_amount_sat 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(); } -/* Generated stub for fromwire_channel_id */ -bool 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_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 log_level_name */ -const char *log_level_name(enum log_level level UNNEEDED) -{ fprintf(stderr, "log_level_name called!\n"); abort(); } -/* Generated stub for log_level_parse */ -bool log_level_parse(const char *levelstr UNNEEDED, size_t len UNNEEDED, - enum log_level *level UNNEEDED) -{ fprintf(stderr, "log_level_parse called!\n"); abort(); } -/* Generated stub for pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace called!\n"); abort(); } -/* Generated stub for towire_amount_msat */ -void towire_amount_msat(u8 **pptr UNNEEDED, const struct amount_msat msat UNNEEDED) -{ fprintf(stderr, "towire_amount_msat called!\n"); abort(); } -/* Generated stub for towire_amount_sat */ -void towire_amount_sat(u8 **pptr UNNEEDED, const struct amount_sat sat UNNEEDED) -{ fprintf(stderr, "towire_amount_sat 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_node_id */ -void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "towire_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int test_socket(int domain UNUSED, int type UNUSED, int protocol UNUSED) diff --git a/cli/test/run-remove-hint.c b/cli/test/run-remove-hint.c index 908621dd985e..7cf8baffa7b7 100644 --- a/cli/test/run-remove-hint.c +++ b/cli/test/run-remove-hint.c @@ -36,84 +36,6 @@ int test_chdir(const char *path); #undef main /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for fromwire_amount_msat */ -struct amount_msat fromwire_amount_msat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_amount_msat called!\n"); abort(); } -/* Generated stub for fromwire_amount_sat */ -struct amount_sat fromwire_amount_sat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_amount_sat 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(); } -/* Generated stub for fromwire_channel_id */ -bool 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_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 log_level_name */ -const char *log_level_name(enum log_level level UNNEEDED) -{ fprintf(stderr, "log_level_name called!\n"); abort(); } -/* Generated stub for log_level_parse */ -bool log_level_parse(const char *levelstr UNNEEDED, size_t len UNNEEDED, - enum log_level *level UNNEEDED) -{ fprintf(stderr, "log_level_parse called!\n"); abort(); } -/* Generated stub for pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace called!\n"); abort(); } -/* Generated stub for towire_amount_msat */ -void towire_amount_msat(u8 **pptr UNNEEDED, const struct amount_msat msat UNNEEDED) -{ fprintf(stderr, "towire_amount_msat called!\n"); abort(); } -/* Generated stub for towire_amount_sat */ -void towire_amount_sat(u8 **pptr UNNEEDED, const struct amount_sat sat UNNEEDED) -{ fprintf(stderr, "towire_amount_sat 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_node_id */ -void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "towire_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int test_socket(int domain UNUSED, int type UNUSED, int protocol UNUSED) diff --git a/closingd/Makefile b/closingd/Makefile index 1c3953c14f20..4d961d289d37 100644 --- a/closingd/Makefile +++ b/closingd/Makefile @@ -17,48 +17,6 @@ ALL_PROGRAMS += lightningd/lightning_closingd LIGHTNINGD_CONTROL_HEADERS += closingd/closingd_wiregen.h LIGHTNINGD_CONTROL_OBJS += closingd/closingd_wiregen.o -# Common source we use. -CLOSINGD_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/bigsize.o \ - common/bip32.o \ - common/channel_id.o \ - common/close_tx.o \ - common/cryptomsg.o \ - common/daemon.o \ - common/daemon_conn.o \ - common/derive_basepoints.o \ - common/gossip_store.o \ - common/htlc_wire.o \ - common/key_derive.o \ - common/memleak.o \ - common/msg_queue.o \ - common/node_id.o \ - common/onionreply.o \ - common/peer_billboard.o \ - common/peer_failed.o \ - common/peer_io.o \ - common/peer_status_wiregen.o \ - common/per_peer_state.o \ - common/permute_tx.o \ - common/ping.o \ - common/psbt_keypath.o \ - common/psbt_open.o \ - common/pseudorand.o \ - common/status_wiregen.o \ - common/read_peer_msg.o \ - common/setup.o \ - common/status.o \ - common/status_wire.o \ - common/subdaemon.o \ - common/utils.o \ - common/utxo.o \ - common/version.o \ - common/wire_error.o \ - common/wireaddr.o - -lightningd/lightning_closingd: $(CLOSINGD_OBJS) $(CLOSINGD_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(HSMD_CLIENT_OBJS) +lightningd/lightning_closingd: $(CLOSINGD_OBJS) $(HSMD_CLIENT_OBJS) libcommon.a -include closingd/test/Makefile diff --git a/closingd/closingd.c b/closingd/closingd.c index 5cf5f5b59b99..a42bcf3f922f 100644 --- a/closingd/closingd.c +++ b/closingd/closingd.c @@ -1,13 +1,10 @@ #include "config.h" #include #include -#include #include #include #include #include -#include -#include #include #include #include @@ -17,14 +14,11 @@ #include #include #include -#include -#include #include #include #include #include #include -#include #include #include diff --git a/closingd/closingd_wire.csv b/closingd/closingd_wire.csv index 10a5d8cbb1b5..55ca558979d0 100644 --- a/closingd/closingd_wire.csv +++ b/closingd/closingd_wire.csv @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/common/Makefile b/common/Makefile index dec98e099b26..2c407e7d8482 100644 --- a/common/Makefile +++ b/common/Makefile @@ -138,12 +138,16 @@ check-common-files: check-source: check-common-files -# Common objects depends on bitcoin/ external/ and ccan -$(COMMON_OBJS): $(CCAN_HEADERS) $(BITCOIN_HEADERS) $(EXTERNAL_HEADERS) $(COMMON_HEADERS_GEN) - # Only common/version.c can include this header. common/version.o: version_gen.h +# Rebuild objects should this file change. +$(COMMON_OBJS): common/Makefile + +# We make a static library, this way linker can discard unused parts. +libcommon.a: $(COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) + @$(call VERBOSE, "ar $@", $(AR) r $@ $?) + ALL_C_HEADERS += $(COMMON_HEADERS) ALL_C_SOURCES += $(COMMON_SRC) @@ -158,6 +162,7 @@ check-whitespace: $(COMMON_SRC_NOGEN:%=check-whitespace/%) $(COMMON_HEADERS:%=ch clean: common-clean common-clean: + $(RM) libcommon.a $(RM) common/gen* include common/test/Makefile diff --git a/common/amount.h b/common/amount.h index b1cdbac1d570..11551b913a94 100644 --- a/common/amount.h +++ b/common/amount.h @@ -1,6 +1,7 @@ #ifndef LIGHTNING_COMMON_AMOUNT_H #define LIGHTNING_COMMON_AMOUNT_H #include "config.h" +#include #include #include diff --git a/common/autodata.h b/common/autodata.h index 60c300bab928..6a18ffc251e7 100644 --- a/common/autodata.h +++ b/common/autodata.h @@ -1,8 +1,6 @@ #ifndef LIGHTNING_COMMON_AUTODATA_H #define LIGHTNING_COMMON_AUTODATA_H #include "config.h" -#include -#include #include #define AUTODATA_TYPE(name, type) \ diff --git a/common/blindedpath.c b/common/blindedpath.c index c13b49d9fc39..5d26c931c23d 100644 --- a/common/blindedpath.c +++ b/common/blindedpath.c @@ -1,13 +1,13 @@ #include "config.h" #include -#include #include #include #include #include +#include #include #include -#include +#include #ifndef SUPERVERBOSE #define SUPERVERBOSE(...) diff --git a/common/blindedpath.h b/common/blindedpath.h index b84869351070..7a5238f15341 100644 --- a/common/blindedpath.h +++ b/common/blindedpath.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_COMMON_BLINDEDPATH_H #define LIGHTNING_COMMON_BLINDEDPATH_H #include "config.h" -#include #include #include diff --git a/common/blindedpay.c b/common/blindedpay.c index 9c3dec2e7268..4d8c3c870320 100644 --- a/common/blindedpay.c +++ b/common/blindedpay.c @@ -1,8 +1,8 @@ #include "config.h" #include #include -#include #include +#include u8 **blinded_onion_hops(const tal_t *ctx, struct amount_msat final_amount, diff --git a/common/blindedpay.h b/common/blindedpay.h index fa99483aa899..b455e38a1f1b 100644 --- a/common/blindedpay.h +++ b/common/blindedpay.h @@ -2,7 +2,6 @@ #ifndef LIGHTNING_COMMON_BLINDEDPAY_H #define LIGHTNING_COMMON_BLINDEDPAY_H #include "config.h" -#include #include struct blinded_path; diff --git a/common/bolt11.c b/common/bolt11.c index bd51fb3df345..7698f497b615 100644 --- a/common/bolt11.c +++ b/common/bolt11.c @@ -1,5 +1,4 @@ #include "config.h" -#include #include #include #include diff --git a/common/bolt11_json.c b/common/bolt11_json.c index c2e7f225d22c..bdc91c124b43 100644 --- a/common/bolt11_json.c +++ b/common/bolt11_json.c @@ -1,6 +1,4 @@ #include "config.h" -#include -#include #include #include #include diff --git a/common/bolt12.c b/common/bolt12.c index f3bcbcdc1b4b..1435b35d854a 100644 --- a/common/bolt12.c +++ b/common/bolt12.c @@ -1,16 +1,13 @@ #include "config.h" -#include #include #include -#include #include #include #include -#include #include #include +#include #include -#include #include /* If chains is NULL, max_num_chains is ignored */ diff --git a/common/bolt12_id.c b/common/bolt12_id.c index 3348b995ae47..7665229cb733 100644 --- a/common/bolt12_id.c +++ b/common/bolt12_id.c @@ -1,6 +1,5 @@ #include "config.h" #include -#include #include #include diff --git a/common/bolt12_merkle.c b/common/bolt12_merkle.c index 6ca21896a29d..dadd6decc4e6 100644 --- a/common/bolt12_merkle.c +++ b/common/bolt12_merkle.c @@ -3,8 +3,8 @@ #include #include #include -#include #include +#include #ifndef SUPERVERBOSE #define SUPERVERBOSE(...) diff --git a/common/channel_type.c b/common/channel_type.c index 61302b45c277..bae0d6b98466 100644 --- a/common/channel_type.c +++ b/common/channel_type.c @@ -1,6 +1,7 @@ #include "config.h" #include #include +#include static struct channel_type *new_channel_type(const tal_t *ctx) { diff --git a/common/close_tx.c b/common/close_tx.c index e4ec9989940b..ee549131ee8d 100644 --- a/common/close_tx.c +++ b/common/close_tx.c @@ -4,7 +4,6 @@ #include #include #include -#include struct bitcoin_tx *create_close_tx(const tal_t *ctx, const struct chainparams *chainparams, diff --git a/common/codex32.c b/common/codex32.c index f74587a634d0..39c9cc0954ee 100644 --- a/common/codex32.c +++ b/common/codex32.c @@ -22,21 +22,11 @@ */ #include "config.h" #include -#include #include -#include #include #include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include +#include struct checksum_engine { u8 generator[15]; diff --git a/common/coin_mvt.c b/common/coin_mvt.c index 4e9ec871e0a6..e797758e697b 100644 --- a/common/coin_mvt.c +++ b/common/coin_mvt.c @@ -6,6 +6,7 @@ #include #include #include +#include #include static const char *mvt_tags[] = { diff --git a/common/coin_mvt.h b/common/coin_mvt.h index e9a41b3251cd..822e6e821b22 100644 --- a/common/coin_mvt.h +++ b/common/coin_mvt.h @@ -3,9 +3,7 @@ #include "config.h" #include -#include #include -#include #define COIN_MVT_VERSION 2 #define ACCOUNT_NAME_WALLET "wallet" diff --git a/common/configdir.c b/common/configdir.c index 248c8e73e010..b4e401a11c59 100644 --- a/common/configdir.c +++ b/common/configdir.c @@ -1,7 +1,6 @@ #include "config.h" #include #include -#include #include #include #include diff --git a/common/configvar.c b/common/configvar.c index 4a3dff39df39..1148f984b24b 100644 --- a/common/configvar.c +++ b/common/configvar.c @@ -4,7 +4,6 @@ #include #include #include -#include struct configvar *configvar_new(const tal_t *ctx, enum configvar_src src, diff --git a/common/cryptomsg.c b/common/cryptomsg.c index f9ede9955de7..4225fefa8f0c 100644 --- a/common/cryptomsg.c +++ b/common/cryptomsg.c @@ -1,5 +1,6 @@ #include "config.h" #include +#include #include #include #include diff --git a/common/cryptomsg.h b/common/cryptomsg.h index 3da33879c4bb..d7c5634d050c 100644 --- a/common/cryptomsg.h +++ b/common/cryptomsg.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_COMMON_CRYPTOMSG_H #define LIGHTNING_COMMON_CRYPTOMSG_H #include "config.h" -#include #include /* BOLT #8: diff --git a/common/decode_array.c b/common/decode_array.c index 0f9a8310b54d..83c7d7703b4f 100644 --- a/common/decode_array.c +++ b/common/decode_array.c @@ -1,6 +1,7 @@ #include "config.h" #include #include +#include #include struct short_channel_id *decode_short_ids(const tal_t *ctx, const u8 *encoded) diff --git a/common/deprecation.c b/common/deprecation.c index 6adabb7fa5ef..3666e2010126 100644 --- a/common/deprecation.c +++ b/common/deprecation.c @@ -1,9 +1,7 @@ #include "config.h" #include -#include #include #include -#include #define MONTH_VAL (10) #define YEAR_VAL (12 * MONTH_VAL) diff --git a/common/dev_disconnect.c b/common/dev_disconnect.c index 2feaf927862e..039897cd8b11 100644 --- a/common/dev_disconnect.c +++ b/common/dev_disconnect.c @@ -1,12 +1,9 @@ #include "config.h" -#include #include #include #include #include #include -#include -#include #include #include diff --git a/common/dijkstra.c b/common/dijkstra.c index afdc4d7be72e..d29173b61d52 100644 --- a/common/dijkstra.c +++ b/common/dijkstra.c @@ -7,6 +7,7 @@ #include #include #include +#include #include /* Each node has this side-info. */ diff --git a/common/ecdh_hsmd.c b/common/ecdh_hsmd.c index b8546ea99031..5e186d51b087 100644 --- a/common/ecdh_hsmd.c +++ b/common/ecdh_hsmd.c @@ -1,5 +1,7 @@ #include "config.h" +#include #include +#include #include #include diff --git a/common/ecdh_hsmd.h b/common/ecdh_hsmd.h index ca9288fbf3ef..7c8aad5b2c6a 100644 --- a/common/ecdh_hsmd.h +++ b/common/ecdh_hsmd.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_COMMON_ECDH_HSMD_H #define LIGHTNING_COMMON_ECDH_HSMD_H #include "config.h" -#include #include /* The via-the-hsmd implementation of ecdh(). */ diff --git a/common/errcode.h b/common/errcode.h index 9fcf6fbedc71..dc3560be5dbc 100644 --- a/common/errcode.h +++ b/common/errcode.h @@ -3,7 +3,6 @@ #include "config.h" -#include // Setup errors #define EXITCODE_SUBDAEMON_FAIL 10 diff --git a/common/features.c b/common/features.c index 030068eb7c7a..7573fea58e0f 100644 --- a/common/features.c +++ b/common/features.c @@ -3,6 +3,7 @@ #include #include #include +#include #include enum feature_copy_style { diff --git a/common/gossip_constants.h b/common/gossip_constants.h index 53ed1cc84281..d5a76231297f 100644 --- a/common/gossip_constants.h +++ b/common/gossip_constants.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_COMMON_GOSSIP_CONSTANTS_H #define LIGHTNING_COMMON_GOSSIP_CONSTANTS_H #include "config.h" -#include /* FIXME: This is a legacy concept, which should be eliminated now we have * only onion tlv payloads. */ diff --git a/common/gossip_store.c b/common/gossip_store.c index 10f4dabe4972..3f10dd82b3ce 100644 --- a/common/gossip_store.c +++ b/common/gossip_store.c @@ -1,14 +1,7 @@ #include "config.h" -#include #include -#include -#include -#include -#include #include -#include #include -#include /* We cheat and read first two bytes of message too. */ struct hdr_and_type { diff --git a/common/gossmap.c b/common/gossmap.c index 1f3c5c017df0..948ed0b9c4c1 100644 --- a/common/gossmap.c +++ b/common/gossmap.c @@ -1,7 +1,5 @@ #include "config.h" -#include #include -#include #include #include #include @@ -9,8 +7,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/common/gossmap.h b/common/gossmap.h index ef3b71a6dc41..1b60a1fdcc00 100644 --- a/common/gossmap.h +++ b/common/gossmap.h @@ -2,9 +2,6 @@ #define LIGHTNING_COMMON_GOSSMAP_H #include "config.h" #include -#include -#include -#include #include #include diff --git a/common/gossmods_listpeerchannels.c b/common/gossmods_listpeerchannels.c index 59754d75c3aa..256bc3090f79 100644 --- a/common/gossmods_listpeerchannels.c +++ b/common/gossmods_listpeerchannels.c @@ -2,7 +2,6 @@ #include #include #include -#include #include void gossmod_add_localchan(struct gossmap_localmods *mods, diff --git a/common/gossmods_listpeerchannels.h b/common/gossmods_listpeerchannels.h index f97694d68931..8a62e77d1434 100644 --- a/common/gossmods_listpeerchannels.h +++ b/common/gossmods_listpeerchannels.h @@ -2,7 +2,6 @@ #define LIGHTNING_COMMON_GOSSMODS_LISTPEERCHANNELS_H #include "config.h" #include -#include #include #include diff --git a/common/hsm_capable.c b/common/hsm_capable.c index a8187681cf2f..5194ea1a2119 100644 --- a/common/hsm_capable.c +++ b/common/hsm_capable.c @@ -1,4 +1,5 @@ #include "config.h" +#include #include /* Is this capability supported by the HSM? (So far, always a message diff --git a/common/hsm_capable.h b/common/hsm_capable.h index 82c9f00f1126..d6d6ddb35891 100644 --- a/common/hsm_capable.h +++ b/common/hsm_capable.h @@ -2,7 +2,6 @@ #define LIGHTNING_COMMON_HSM_CAPABLE_H #include "config.h" #include -#include #include /* Is this capability supported by the HSM? (So far, always a message diff --git a/common/hsm_encryption.c b/common/hsm_encryption.c index 33fc617f7a00..3486773dd4f3 100644 --- a/common/hsm_encryption.c +++ b/common/hsm_encryption.c @@ -1,8 +1,7 @@ #include "config.h" -#include #include #include -#include +#include #include #include diff --git a/common/hsm_encryption.h b/common/hsm_encryption.h index 0f1b36097def..af67701adead 100644 --- a/common/hsm_encryption.h +++ b/common/hsm_encryption.h @@ -2,9 +2,7 @@ #define LIGHTNING_COMMON_HSM_ENCRYPTION_H #include "config.h" #include -#include #include -#include /* Length of the encrypted hsm secret header. */ #define HS_HEADER_LEN crypto_secretstream_xchacha20poly1305_HEADERBYTES diff --git a/common/htlc.h b/common/htlc.h index c300f0ffe5d9..b933e07cd050 100644 --- a/common/htlc.h +++ b/common/htlc.h @@ -3,7 +3,6 @@ #include "config.h" #include "bitcoin/locktime.h" #include "htlc_state.h" -#include #include #define NUM_SIDES (REMOTE + 1) diff --git a/common/htlc_tx.h b/common/htlc_tx.h index a08a90f8bdc6..4e9f09a589ee 100644 --- a/common/htlc_tx.h +++ b/common/htlc_tx.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_COMMON_HTLC_TX_H #define LIGHTNING_COMMON_HTLC_TX_H #include "config.h" -#include #include #include #include diff --git a/common/htlc_wire.c b/common/htlc_wire.c index bb17e738b9a7..5ccd75795ad5 100644 --- a/common/htlc_wire.c +++ b/common/htlc_wire.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include static struct failed_htlc *failed_htlc_dup(const tal_t *ctx, const struct failed_htlc *f TAKES) diff --git a/common/initial_channel.c b/common/initial_channel.c index bbda5c585514..417b766cc861 100644 --- a/common/initial_channel.c +++ b/common/initial_channel.c @@ -31,6 +31,19 @@ struct channel *new_initial_channel(const tal_t *ctx, struct channel *channel = tal(ctx, struct channel); struct amount_msat remote_msatoshi; + /* takes() if necessary */ + channel->fee_states = dup_fee_states(channel, fee_states); + + /* takes() if necessary */ + if (!height_states) + channel->blockheight_states = NULL; + else + channel->blockheight_states + = dup_height_states(channel, height_states); + + /* takes() if necessary */ + channel->type = tal_dup(channel, struct channel_type, type); + channel->cid = *cid; channel->funding = *funding; channel->funding_sats = funding_sats; @@ -47,16 +60,6 @@ struct channel *new_initial_channel(const tal_t *ctx, channel->funding_pubkey[REMOTE] = *remote_funding_pubkey; channel->htlcs = NULL; - /* takes() if necessary */ - channel->fee_states = dup_fee_states(channel, fee_states); - - /* takes() if necessary */ - if (!height_states) - channel->blockheight_states = NULL; - else - channel->blockheight_states - = dup_height_states(channel, height_states); - channel->view[LOCAL].owed[LOCAL] = channel->view[REMOTE].owed[LOCAL] = local_msatoshi; @@ -77,8 +80,6 @@ struct channel *new_initial_channel(const tal_t *ctx, &channel->basepoints[!opener].payment); channel->option_wumbo = option_wumbo; - /* takes() if necessary */ - channel->type = tal_dup(channel, struct channel_type, type); return channel; } diff --git a/common/initial_commit_tx.h b/common/initial_commit_tx.h index 6e715831b09b..7b61b7b8a206 100644 --- a/common/initial_commit_tx.h +++ b/common/initial_commit_tx.h @@ -2,7 +2,6 @@ #ifndef LIGHTNING_COMMON_INITIAL_COMMIT_TX_H #define LIGHTNING_COMMON_INITIAL_COMMIT_TX_H #include "config.h" -#include #include #include #include diff --git a/common/interactivetx.c b/common/interactivetx.c index 6e1aa1c916d5..87473aeeebcb 100644 --- a/common/interactivetx.c +++ b/common/interactivetx.c @@ -1,27 +1,16 @@ #include "config.h" -#include #include #include -#include #include -#include #include -#include -#include -#include -#include #include #include -#include -#include -#include #include -#include #include -#include #include -#include +#include #include +#include #ifndef SUPERVERBOSE #define SUPERVERBOSE(...) diff --git a/common/interactivetx.h b/common/interactivetx.h index af17e1453c8e..967bb167b79d 100644 --- a/common/interactivetx.h +++ b/common/interactivetx.h @@ -2,12 +2,8 @@ #define LIGHTNING_COMMON_INTERACTIVETX_H #include "config.h" -#include #include -#include #include -#include -#include /* Interactive tx handles the building and updating of a transaction between * two peers. A PSBT is passed back and forth between two peers in steps. In diff --git a/common/json_blinded_path.c b/common/json_blinded_path.c index 78ef625e60f4..bac2be4223d8 100644 --- a/common/json_blinded_path.c +++ b/common/json_blinded_path.c @@ -1,7 +1,8 @@ #include "config.h" #include #include -#include +#include +#include struct blinded_path * json_to_blinded_path(const tal_t *ctx, const char *buffer, const jsmntok_t *tok) diff --git a/common/json_channel_type.c b/common/json_channel_type.c index bb175e8f649e..91c618113e8b 100644 --- a/common/json_channel_type.c +++ b/common/json_channel_type.c @@ -2,7 +2,6 @@ #include #include #include -#include #include struct command_result *param_channel_type(struct command *cmd, diff --git a/common/json_command.h b/common/json_command.h index d0c0667f4281..7b77cc8e76e4 100644 --- a/common/json_command.h +++ b/common/json_command.h @@ -3,9 +3,7 @@ #ifndef LIGHTNING_COMMON_JSON_COMMAND_H #define LIGHTNING_COMMON_JSON_COMMAND_H #include "config.h" -#include #include -#include #include struct command; diff --git a/common/json_filter.h b/common/json_filter.h index dee177aebe8a..3e9116df961e 100644 --- a/common/json_filter.h +++ b/common/json_filter.h @@ -4,9 +4,7 @@ #ifndef LIGHTNING_COMMON_JSON_FILTER_H #define LIGHTNING_COMMON_JSON_FILTER_H #include "config.h" -#include #include -#include struct command; struct json_filter; diff --git a/common/json_param.c b/common/json_param.c index c92de191a597..1b529707016f 100644 --- a/common/json_param.c +++ b/common/json_param.c @@ -1,7 +1,6 @@ #include "config.h" #include #include -#include #include #include #include @@ -10,10 +9,10 @@ #include #include #include -#include #include #include #include +#include /* Overridden by run-param.c */ #ifndef paramcheck_assert diff --git a/common/json_param.h b/common/json_param.h index e41528a2098b..a000c71b1179 100644 --- a/common/json_param.h +++ b/common/json_param.h @@ -2,13 +2,10 @@ #ifndef LIGHTNING_COMMON_JSON_PARAM_H #define LIGHTNING_COMMON_JSON_PARAM_H #include "config.h" -#include #include #include #include -#include #include -#include /*~ Greetings adventurer! * diff --git a/common/json_parse.c b/common/json_parse.c index 260e9e1b5c89..dc491b2a012e 100644 --- a/common/json_parse.c +++ b/common/json_parse.c @@ -4,23 +4,14 @@ #include #include #include -#include -#include -#include #include #include #include -#include -#include -#include #include #include #include #include #include -#include -#include -#include bool json_to_millionths(const char *buffer, const jsmntok_t *tok, u64 *millionths) diff --git a/common/json_parse.h b/common/json_parse.h index 4bd23cbddcd7..8f3bcfc322b9 100644 --- a/common/json_parse.h +++ b/common/json_parse.h @@ -2,9 +2,7 @@ #define LIGHTNING_COMMON_JSON_PARSE_H #include "config.h" #include -#include #include -#include /* Simple helpers are here: this file contains heavier ones */ #include #include diff --git a/common/json_parse_simple.c b/common/json_parse_simple.c index e3b2cba82052..f3b3da808f39 100644 --- a/common/json_parse_simple.c +++ b/common/json_parse_simple.c @@ -6,9 +6,6 @@ #include #include #include -#include -#include -#include const char *json_tok_full(const char *buffer, const jsmntok_t *t) { diff --git a/common/json_stream.c b/common/json_stream.c index 7d1cc92cbd9a..582e5e7e3269 100644 --- a/common/json_stream.c +++ b/common/json_stream.c @@ -1,25 +1,15 @@ #include "config.h" #include -#include -#include #include #include -#include #include /* To reach into io_plan: not a public header! */ #include #include #include #include -#include -#include -#include -#include #include -#include #include -#include -#include #include #include #include diff --git a/common/json_stream.h b/common/json_stream.h index bfbb5d0a78df..da65761c86f6 100644 --- a/common/json_stream.h +++ b/common/json_stream.h @@ -9,8 +9,6 @@ # include #include -#include -#include #include #include #include diff --git a/common/jsonrpc_errors.h b/common/jsonrpc_errors.h index da9e337720e1..48ff0788401f 100644 --- a/common/jsonrpc_errors.h +++ b/common/jsonrpc_errors.h @@ -6,7 +6,6 @@ #include "config.h" -#include enum jsonrpc_errcode { /* Standard errors defined by JSON-RPC 2.0 standard */ diff --git a/common/key_derive.c b/common/key_derive.c index 07c74614edc5..cc2a91326662 100644 --- a/common/key_derive.c +++ b/common/key_derive.c @@ -3,7 +3,6 @@ #include #include #include -#include /* BOLT #3: * diff --git a/common/key_derive.h b/common/key_derive.h index b078cc9261e0..8ea5419d3439 100644 --- a/common/key_derive.h +++ b/common/key_derive.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_COMMON_KEY_DERIVE_H #define LIGHTNING_COMMON_KEY_DERIVE_H #include "config.h" -#include #include struct pubkey; diff --git a/common/lease_rates.c b/common/lease_rates.c index 403804e92b2a..7bcb3ce0c519 100644 --- a/common/lease_rates.c +++ b/common/lease_rates.c @@ -2,6 +2,7 @@ #include #include #include +#include bool lease_rates_empty(const struct lease_rates *rates) { diff --git a/common/lease_rates.h b/common/lease_rates.h index 0b87b38e332b..3651f9555b24 100644 --- a/common/lease_rates.h +++ b/common/lease_rates.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_COMMON_LEASE_RATES_H #define LIGHTNING_COMMON_LEASE_RATES_H #include "config.h" -#include #include struct amount_msat; diff --git a/common/memleak.h b/common/memleak.h index a15413b23f34..0ff2dc5af0f5 100644 --- a/common/memleak.h +++ b/common/memleak.h @@ -3,8 +3,6 @@ #include "config.h" #include #include -#include -#include struct htable; struct list_head; diff --git a/common/msg_queue.c b/common/msg_queue.c index ba702f373053..566bb3bff9ca 100644 --- a/common/msg_queue.c +++ b/common/msg_queue.c @@ -1,10 +1,7 @@ #include "config.h" -#include -#include #include #include #include -#include #include static bool warned_once; diff --git a/common/node_id.c b/common/node_id.c index 4998323e204e..f98bb8159335 100644 --- a/common/node_id.c +++ b/common/node_id.c @@ -56,14 +56,16 @@ void fromwire_node_id(const u8 **cursor, size_t *max, struct node_id *id) fromwire(cursor, max, &id->k, sizeof(id->k)); } +bool dev_towire_allow_invalid_node_id = false; + void towire_node_id(u8 **pptr, const struct node_id *id) { -#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION /* Cheap sanity check. For wire fuzzing, we only care about correct * encoding of node IDs and not whether the IDs are valid, so we disable * this check while fuzzing. */ - assert(id->k[0] == 0x2 || id->k[0] == 0x3); -#endif + if (!dev_towire_allow_invalid_node_id) + assert(id->k[0] == 0x2 || id->k[0] == 0x3); + towire(pptr, id->k, sizeof(id->k)); } diff --git a/common/node_id.h b/common/node_id.h index fa4779c1a3e8..6b1087ed1ab6 100644 --- a/common/node_id.h +++ b/common/node_id.h @@ -4,7 +4,6 @@ #include "config.h" #include #include -#include #include struct sha256_double; @@ -49,6 +48,9 @@ static inline int node_id_idx(const struct node_id *id1, void towire_node_id(u8 **pptr, const struct node_id *id); void fromwire_node_id(const u8 **cursor, size_t *max, struct node_id *id); +/* Fuzzer creates these, so sets this flag to allow it */ +extern bool dev_towire_allow_invalid_node_id; + /* Hash table functions for node ids */ static inline const struct node_id *node_id_keyof(const struct node_id *id) { diff --git a/common/onion_decode.c b/common/onion_decode.c index d1bc9b0bdea6..285c634c301b 100644 --- a/common/onion_decode.c +++ b/common/onion_decode.c @@ -1,15 +1,12 @@ #include "config.h" -#include -#include -#include #include #include #include #include #include #include +#include #include -#include /* BOLT #4: * - If `encrypted_recipient_data` is present: diff --git a/common/onion_decode.h b/common/onion_decode.h index c1149972b78f..f1d637fc60ba 100644 --- a/common/onion_decode.h +++ b/common/onion_decode.h @@ -1,8 +1,6 @@ #ifndef LIGHTNING_COMMON_ONION_DECODE_H #define LIGHTNING_COMMON_ONION_DECODE_H #include "config.h" -#include -#include #include /** diff --git a/common/onion_encode.c b/common/onion_encode.c index ee9747189b06..2b817e1842e3 100644 --- a/common/onion_encode.c +++ b/common/onion_encode.c @@ -1,13 +1,9 @@ #include "config.h" #include -#include #include -#include -#include -#include #include #include -#include +#include /* BOLT #4: * diff --git a/common/onion_message.c b/common/onion_message.c index c781866ee78c..34faf004ca86 100644 --- a/common/onion_message.c +++ b/common/onion_message.c @@ -1,13 +1,11 @@ #include "config.h" #include -#include #include #include #include #include #include #include -#include struct tlv_encrypted_data_tlv **new_encdata_tlvs(const tal_t *ctx, const struct pubkey *ids, diff --git a/common/onion_message.h b/common/onion_message.h index 03139828d5b5..e5da47d49860 100644 --- a/common/onion_message.h +++ b/common/onion_message.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_COMMON_ONION_MESSAGE_H #define LIGHTNING_COMMON_ONION_MESSAGE_H #include "config.h" -#include #include #include diff --git a/common/onion_message_parse.c b/common/onion_message_parse.c index 9becf60d136c..8668c85d9d09 100644 --- a/common/onion_message_parse.c +++ b/common/onion_message_parse.c @@ -6,9 +6,7 @@ #include #include #include -#include #include -#include #include static bool decrypt_final_onionmsg(const tal_t *ctx, diff --git a/common/onion_message_parse.h b/common/onion_message_parse.h index af4c51908946..6cc1b126addc 100644 --- a/common/onion_message_parse.h +++ b/common/onion_message_parse.h @@ -2,7 +2,6 @@ #define LIGHTNING_COMMON_ONION_MESSAGE_PARSE_H #include "config.h" #include -#include struct tlv_onionmsg_tlv; struct sciddir_or_pubkey; diff --git a/common/onionreply.c b/common/onionreply.c index 6a6e58ff96b2..74a20a57ce28 100644 --- a/common/onionreply.c +++ b/common/onionreply.c @@ -1,7 +1,6 @@ #include "config.h" #include #include -#include #include void towire_onionreply(u8 **cursor, const struct onionreply *r) diff --git a/common/peer_failed.c b/common/peer_failed.c index f21754e3a96e..e9864e363fe1 100644 --- a/common/peer_failed.c +++ b/common/peer_failed.c @@ -8,6 +8,7 @@ #include #include #include +#include #include /* Fatal error here, return peer control to lightningd */ diff --git a/common/peer_io.c b/common/peer_io.c index 3f090a834ea4..79812b77f589 100644 --- a/common/peer_io.c +++ b/common/peer_io.c @@ -1,17 +1,9 @@ #include "config.h" -#include #include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include #include void peer_write(struct per_peer_state *pps, const void *msg TAKES) diff --git a/common/per_peer_state.c b/common/per_peer_state.c index 981e06c07126..ee93565cdfda 100644 --- a/common/per_peer_state.c +++ b/common/per_peer_state.c @@ -1,10 +1,8 @@ #include "config.h" #include #include -#include #include #include -#include bool dev_fast_gossip = false; diff --git a/common/per_peer_state.h b/common/per_peer_state.h index 0561d8ce2870..23dce6833176 100644 --- a/common/per_peer_state.h +++ b/common/per_peer_state.h @@ -2,8 +2,6 @@ #define LIGHTNING_COMMON_PER_PEER_STATE_H #include "config.h" -#include -#include #include /* Things we hand between daemons to talk to peers. */ diff --git a/common/ping.c b/common/ping.c index cfba85f034a7..4c98f095e32b 100644 --- a/common/ping.c +++ b/common/ping.c @@ -1,7 +1,5 @@ #include "config.h" #include -#include -#include #include bool check_ping_make_pong(const tal_t *ctx, const u8 *ping, u8 **pong) diff --git a/common/psbt_internal.c b/common/psbt_internal.c index 44501d6dfb48..22d46852491a 100644 --- a/common/psbt_internal.c +++ b/common/psbt_internal.c @@ -2,9 +2,9 @@ #include #include #include -#include #include #include +#include #include diff --git a/common/psbt_keypath.c b/common/psbt_keypath.c index dbc055f6e530..dcd89a9ea415 100644 --- a/common/psbt_keypath.c +++ b/common/psbt_keypath.c @@ -2,7 +2,6 @@ #include #include #include -#include void psbt_output_set_keypath(u32 index, const struct ext_key *ext, bool is_taproot, struct wally_psbt_output *output) { u8 fingerprint[BIP32_KEY_FINGERPRINT_LEN]; diff --git a/common/psbt_open.c b/common/psbt_open.c index d58932250341..5cf83b50fc33 100644 --- a/common/psbt_open.c +++ b/common/psbt_open.c @@ -2,8 +2,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/common/psbt_open.h b/common/psbt_open.h index b3c74c92ad1f..da0d30d42601 100644 --- a/common/psbt_open.h +++ b/common/psbt_open.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_COMMON_PSBT_OPEN_H #define LIGHTNING_COMMON_PSBT_OPEN_H #include "config.h" -#include #include #include #include diff --git a/common/pseudorand.c b/common/pseudorand.c index 831be2bb584b..b29aeee0621e 100644 --- a/common/pseudorand.c +++ b/common/pseudorand.c @@ -1,13 +1,10 @@ #include "config.h" #include #include -#include #include -#include #include #include #include -#include static struct isaac64_ctx isaac64; static struct siphash_seed siphashseed; diff --git a/common/pseudorand.h b/common/pseudorand.h index a34220055560..ebe9e0b59ab1 100644 --- a/common/pseudorand.h +++ b/common/pseudorand.h @@ -1,6 +1,7 @@ #ifndef LIGHTNING_COMMON_PSEUDORAND_H #define LIGHTNING_COMMON_PSEUDORAND_H #include "config.h" +#include #include #include diff --git a/common/read_peer_msg.c b/common/read_peer_msg.c index b10de75e1726..292cc6ecc0bc 100644 --- a/common/read_peer_msg.c +++ b/common/read_peer_msg.c @@ -1,16 +1,10 @@ #include "config.h" -#include #include #include -#include -#include -#include #include #include +#include #include -#include -#include -#include bool handle_peer_error_or_warning(struct per_peer_state *pps, const u8 *msg TAKES) diff --git a/common/route.c b/common/route.c index b699742abe90..534594eabd09 100644 --- a/common/route.c +++ b/common/route.c @@ -1,7 +1,6 @@ #include "config.h" #include #include -#include #include #include diff --git a/common/scb_wire.csv b/common/scb_wire.csv index f955b6bca525..537c564ca51b 100644 --- a/common/scb_wire.csv +++ b/common/scb_wire.csv @@ -7,6 +7,7 @@ #include #include #include +#include tlvtype,scb_tlvs,shachain,1, tlvdata,scb_tlvs,shachain,their_shachain,shachain, diff --git a/common/shutdown_scriptpubkey.c b/common/shutdown_scriptpubkey.c index 05d7b22e95a8..6c82baf2685b 100644 --- a/common/shutdown_scriptpubkey.c +++ b/common/shutdown_scriptpubkey.c @@ -1,6 +1,7 @@ #include "config.h" #include #include +#include #include /* BOLT #2: diff --git a/common/sphinx.c b/common/sphinx.c index c254e63170bc..dd405a05f3e0 100644 --- a/common/sphinx.c +++ b/common/sphinx.c @@ -3,11 +3,10 @@ #include #include -#include #include #include #include - +#include #include diff --git a/common/sphinx.h b/common/sphinx.h index 933e82627bb4..b559d61a85e9 100644 --- a/common/sphinx.h +++ b/common/sphinx.h @@ -6,7 +6,7 @@ #include "bitcoin/pubkey.h" #include -#include +#include struct node_id; diff --git a/common/splice_script.c b/common/splice_script.c index fd07c3e2271a..0affda6ef140 100644 --- a/common/splice_script.c +++ b/common/splice_script.c @@ -1,16 +1,12 @@ #include "config.h" #include #include -#include #include #include #include -#include #include #include -#include #include -#include #include #include diff --git a/common/splice_script.h b/common/splice_script.h index 17b3de28916d..fd2c9b07bb99 100644 --- a/common/splice_script.h +++ b/common/splice_script.h @@ -2,7 +2,6 @@ #define LIGHTNING_COMMON_SPLICE_SCRIPT_H #include "config.h" -#include #include #include #include diff --git a/common/status.c b/common/status.c index 87a554003833..7de0ebdfa6f7 100644 --- a/common/status.c +++ b/common/status.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/common/test/Makefile b/common/test/Makefile index db0fbcaab70e..5c57de91fe0c 100644 --- a/common/test/Makefile +++ b/common/test/Makefile @@ -9,7 +9,7 @@ COMMON_TEST_COMMON_OBJS := \ common/utils.o $(COMMON_TEST_PROGRAMS): $(COMMON_TEST_COMMON_OBJS) $(BITCOIN_OBJS) -$(COMMON_TEST_OBJS): $(COMMON_HEADERS) $(WIRE_HEADERS) $(COMMON_SRC) +$(COMMON_TEST_OBJS): $(COMMON_HEADERS) $(WIRE_HEADERS) $(COMMON_SRC) common/test/Makefile ALL_C_SOURCES += $(COMMON_TEST_SRC) ALL_TEST_PROGRAMS += $(COMMON_TEST_PROGRAMS) diff --git a/common/test/run-bolt12-format-string-test.c b/common/test/run-bolt12-format-string-test.c index dc8384750a09..e120af65f6f1 100644 --- a/common/test/run-bolt12-format-string-test.c +++ b/common/test/run-bolt12-format-string-test.c @@ -9,6 +9,7 @@ #include #include #include +#include /* AUTOGENERATED MOCKS START */ /* Generated stub for features_unsupported */ diff --git a/common/test/run-bolt12_decode.c b/common/test/run-bolt12_decode.c index 4702d23f251c..6f0fa2a55faf 100644 --- a/common/test/run-bolt12_decode.c +++ b/common/test/run-bolt12_decode.c @@ -5,6 +5,7 @@ #include "../json_parse.c" #include "../json_parse_simple.c" #include +#include #include #include #include diff --git a/common/test/run-bolt12_merkle-json.c b/common/test/run-bolt12_merkle-json.c index 4c0910d3f57f..dba66a2957f8 100644 --- a/common/test/run-bolt12_merkle-json.c +++ b/common/test/run-bolt12_merkle-json.c @@ -8,6 +8,7 @@ #include "../../wire/fromwire.c" #include "../../wire/peer_wiregen.c" #include "../../wire/tlvstream.c" +#include #include #include #include diff --git a/common/test/run-codex32.c b/common/test/run-codex32.c index 2aed32315799..3b32582f931c 100644 --- a/common/test/run-codex32.c +++ b/common/test/run-codex32.c @@ -9,6 +9,7 @@ #include #include #include +#include /* AUTOGENERATED MOCKS START */ /* Generated stub for amount_asset_is_main */ diff --git a/common/test/run-cryptomsg.c b/common/test/run-cryptomsg.c index 42fa16e89c1b..9b7619d95bfe 100644 --- a/common/test/run-cryptomsg.c +++ b/common/test/run-cryptomsg.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/common/test/run-json.c b/common/test/run-json.c index b5fdecdb3c64..529d96c62c47 100644 --- a/common/test/run-json.c +++ b/common/test/run-json.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include diff --git a/common/test/run-json_scan.c b/common/test/run-json_scan.c index a80dad990606..ab3e487ca37e 100644 --- a/common/test/run-json_scan.c +++ b/common/test/run-json_scan.c @@ -3,6 +3,7 @@ #include "../json_parse_simple.c" #include #include +#include #include /* AUTOGENERATED MOCKS START */ diff --git a/common/trace.c b/common/trace.c index eade3171f790..7ffe7eac132d 100644 --- a/common/trace.c +++ b/common/trace.c @@ -4,13 +4,10 @@ #include #include #include -#include -#include #include -#include #include #include -#include +#include #include #include diff --git a/common/utils.h b/common/utils.h index 26992fdb06b0..45b91f87f827 100644 --- a/common/utils.h +++ b/common/utils.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_COMMON_UTILS_H #define LIGHTNING_COMMON_UTILS_H #include "config.h" -#include #include #include #include diff --git a/common/utxo.c b/common/utxo.c index 93ec50d3e897..ca978c507b6b 100644 --- a/common/utxo.c +++ b/common/utxo.c @@ -1,6 +1,5 @@ #include "config.h" #include -#include size_t utxo_spend_weight(const struct utxo *utxo, size_t min_witness_weight) { diff --git a/common/version.c b/common/version.c index 0840968fdb75..5e762e20bfa1 100644 --- a/common/version.c +++ b/common/version.c @@ -1,10 +1,7 @@ #include "config.h" -#include #include #include #include -#include -#include /* Only common/version.c can safely include this. */ # include "version_gen.h" diff --git a/common/wire_error.c b/common/wire_error.c index 512a1cf6b78a..bf8217600584 100644 --- a/common/wire_error.c +++ b/common/wire_error.c @@ -1,6 +1,7 @@ #include "config.h" #include #include +#include #include #include diff --git a/common/wireaddr.c b/common/wireaddr.c index 80b8105b62eb..9afca6f631a0 100644 --- a/common/wireaddr.c +++ b/common/wireaddr.c @@ -8,7 +8,6 @@ #include #include #include -#include #include bool wireaddr_eq(const struct wireaddr *a, const struct wireaddr *b) diff --git a/connectd/Makefile b/connectd/Makefile index 781172e186de..33e6e8b6ffb5 100644 --- a/connectd/Makefile +++ b/connectd/Makefile @@ -35,61 +35,8 @@ ALL_PROGRAMS += lightningd/lightning_websocketd LIGHTNINGD_CONTROL_HEADERS += connectd/connectd_wiregen.h LIGHTNINGD_CONTROL_OBJS += connectd/connectd_wiregen.o -# Common source we use. -CONNECTD_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/base64.o \ - common/bech32.o \ - common/bech32_util.o \ - common/bigsize.o \ - common/bip32.o \ - common/blinding.o \ - common/blindedpath.o \ - common/channel_id.o \ - common/cryptomsg.o \ - common/daemon.o \ - common/daemon_conn.o \ - common/decode_array.o \ - common/derive_basepoints.o \ - common/dev_disconnect.o \ - common/ecdh_hsmd.o \ - common/features.o \ - common/fp16.o \ - common/hmac.o \ - common/status_wiregen.o \ - common/gossip_store.o \ - common/gossmap.o \ - common/key_derive.o \ - common/memleak.o \ - common/msg_queue.o \ - common/node_id.o \ - common/onion_decode.o \ - common/onionreply.o \ - common/onion_message_parse.o \ - common/ping.o \ - common/per_peer_state.o \ - common/psbt_open.o \ - common/pseudorand.o \ - common/sciddir_or_pubkey.o \ - common/setup.o \ - common/sphinx.o \ - common/status.o \ - common/status_wire.o \ - common/subdaemon.o \ - common/timeout.o \ - common/utils.o \ - common/utxo.o \ - common/version.o \ - common/wireaddr.o \ - common/wire_error.o \ - gossipd/gossipd_wiregen.o \ - gossipd/gossip_store_wiregen.o \ - wire/onion_wiregen.o +lightningd/lightning_connectd: $(CONNECTD_OBJS) $(HSMD_CLIENT_OBJS) gossipd/gossipd_wiregen.o gossipd/gossip_store_wiregen.o libcommon.a -lightningd/lightning_connectd: $(CONNECTD_OBJS) $(CONNECTD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(HSMD_CLIENT_OBJS) - -lightningd/lightning_websocketd: $(WEBSOCKETD_OBJS) common/setup.o common/utils.o common/autodata.o +lightningd/lightning_websocketd: $(WEBSOCKETD_OBJS) libcommon.a include connectd/test/Makefile diff --git a/connectd/connectd.c b/connectd/connectd.c index f04f2caa798d..e2cb6811a329 100644 --- a/connectd/connectd.c +++ b/connectd/connectd.c @@ -12,23 +12,22 @@ #include #include #include -#include -#include #include #include #include #include #include +#include #include #include +#include #include -#include #include -#include #include #include #include #include +#include #include #include #include @@ -43,16 +42,12 @@ #include #include #include -#include -#include #include #include -#include #include -#include +#include // MacOS needs this for closefrom() #include #include -#include /*~ We are passed two file descriptors when exec'ed from `lightningd`: the * first is a connection to `hsmd`, which we need for the cryptographic diff --git a/connectd/connectd.h b/connectd/connectd.h index 5774c220f4da..09778e2d5015 100644 --- a/connectd/connectd.h +++ b/connectd/connectd.h @@ -1,16 +1,12 @@ #ifndef LIGHTNING_CONNECTD_CONNECTD_H #define LIGHTNING_CONNECTD_CONNECTD_H #include "config.h" -#include #include -#include #include #include #include -#include #include #include -#include #include #include diff --git a/connectd/connectd_gossipd_wire.csv b/connectd/connectd_gossipd_wire.csv index 195a73421bb8..d6be886a652d 100644 --- a/connectd/connectd_gossipd_wire.csv +++ b/connectd/connectd_gossipd_wire.csv @@ -1,6 +1,4 @@ #include -#include -#include # Communication between gossipd and connectd. msgtype,gossipd_new_peer,4000 diff --git a/connectd/connectd_wire.csv b/connectd/connectd_wire.csv index 23b7d37da131..78df85efc848 100644 --- a/connectd/connectd_wire.csv +++ b/connectd/connectd_wire.csv @@ -1,10 +1,8 @@ -#include #include -#include #include #include #include -#include +#include msgtype,connectd_init,2000 msgdata,connectd_init,chainparams,chainparams, diff --git a/connectd/gossip_rcvd_filter.c b/connectd/gossip_rcvd_filter.c index c8097a4d6cb3..5f628c1763c0 100644 --- a/connectd/gossip_rcvd_filter.c +++ b/connectd/gossip_rcvd_filter.c @@ -1,9 +1,6 @@ #include "config.h" -#include #include #include -#include -#include #include #include diff --git a/connectd/gossip_store.c b/connectd/gossip_store.c index 7a6bb61dc05d..60da90f30be6 100644 --- a/connectd/gossip_store.c +++ b/connectd/gossip_store.c @@ -1,6 +1,7 @@ #include "config.h" #include #include +#include #include #include #include diff --git a/connectd/multiplex.c b/connectd/multiplex.c index 77101e207603..55e18c9e0c6a 100644 --- a/connectd/multiplex.c +++ b/connectd/multiplex.c @@ -1,19 +1,12 @@ /*~ This contains all the code to shuffle data between socket to the peer * itself, and the subdaemons. */ #include "config.h" -#include -#include -#include -#include #include #include #include #include -#include -#include #include #include -#include #include #include #include @@ -23,21 +16,15 @@ #include #include #include -#include #include #include #include #include -#include +#include #include #include -#include -#include -#include #include -#include #include -#include struct subd { /* Owner: we are in peer->subds[] */ diff --git a/connectd/onion_message.c b/connectd/onion_message.c index 09940e855b59..27718b757934 100644 --- a/connectd/onion_message.c +++ b/connectd/onion_message.c @@ -1,15 +1,10 @@ /*~ This contains all the code to handle onion messages. */ #include "config.h" -#include #include -#include -#include #include -#include -#include #include -#include #include +#include #include #include #include diff --git a/connectd/peer_exchange_initmsg.c b/connectd/peer_exchange_initmsg.c index b0a29549caba..bbcb6b44da0f 100644 --- a/connectd/peer_exchange_initmsg.c +++ b/connectd/peer_exchange_initmsg.c @@ -1,9 +1,9 @@ #include "config.h" -#include #include +#include #include -#include #include +#include #include #include #include diff --git a/connectd/queries.c b/connectd/queries.c index 3a680cb75bbd..59f2bf52fa64 100644 --- a/connectd/queries.c +++ b/connectd/queries.c @@ -1,13 +1,12 @@ /* Routines to handle gossip query messages */ #include "config.h" -#include #include #include #include -#include #include #include #include +#include #include #include #include diff --git a/connectd/test/Makefile b/connectd/test/Makefile index c624f32190c2..3bdb1c380642 100644 --- a/connectd/test/Makefile +++ b/connectd/test/Makefile @@ -4,20 +4,13 @@ CONNECTD_TEST_SRC := $(wildcard connectd/test/run-*.c) CONNECTD_TEST_OBJS := $(CONNECTD_TEST_SRC:.c=.o) CONNECTD_TEST_PROGRAMS := $(CONNECTD_TEST_OBJS:.o=) -CONNECTD_TEST_COMMON_OBJS := \ - common/autodata.o \ - common/features.o \ - common/pseudorand.o \ - common/setup.o \ - common/utils.o - ALL_C_SOURCES += $(CONNECTD_TEST_SRC) ALL_TEST_PROGRAMS += $(CONNECTD_TEST_PROGRAMS) -$(CONNECTD_TEST_PROGRAMS): $(CONNECTD_TEST_COMMON_OBJS) $(BITCOIN_OBJS) +$(CONNECTD_TEST_PROGRAMS): libcommon.a # Test objects depend on ../ src and headers. -$(CONNECTD_TEST_OBJS): $(CONNECTD_HEADERS) $(CONNECTD_SRC) $(WEBSOCKETD_HEADERS) $(WEBSOCKETD_SRC) +$(CONNECTD_TEST_OBJS): $(CONNECTD_HEADERS) $(CONNECTD_SRC) $(WEBSOCKETD_HEADERS) $(WEBSOCKETD_SRC) connectd/test/Makefile check-units: $(CONNECTD_TEST_PROGRAMS:%=unittest/%) diff --git a/connectd/test/run-crc32_of_update.c b/connectd/test/run-crc32_of_update.c index efcaaf4792d7..4555c12daf04 100644 --- a/connectd/test/run-crc32_of_update.c +++ b/connectd/test/run-crc32_of_update.c @@ -12,215 +12,15 @@ int unused_main(int argc, char *argv[]); #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for bigsize_len */ -size_t bigsize_len(bigsize_t v UNNEEDED) -{ fprintf(stderr, "bigsize_len called!\n"); abort(); } -/* Generated stub for decode_scid_query_flags */ -bigsize_t *decode_scid_query_flags(const tal_t *ctx UNNEEDED, - const struct tlv_query_short_channel_ids_tlvs_query_flags *qf UNNEEDED) -{ fprintf(stderr, "decode_scid_query_flags called!\n"); abort(); } -/* Generated stub for decode_short_ids */ -struct short_channel_id *decode_short_ids(const tal_t *ctx UNNEEDED, const u8 *encoded UNNEEDED) -{ fprintf(stderr, "decode_short_ids called!\n"); abort(); } -/* Generated stub for fromwire */ -const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) -{ fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_bool */ -bool fromwire_bool(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_bool called!\n"); abort(); } /* Generated stub for fromwire_connectd_dev_set_max_scids_encode_size */ bool fromwire_connectd_dev_set_max_scids_encode_size(const void *p UNNEEDED, u32 *max UNNEEDED) { fprintf(stderr, "fromwire_connectd_dev_set_max_scids_encode_size called!\n"); abort(); } -/* Generated stub for fromwire_fail */ -void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_fail called!\n"); abort(); } -/* Generated stub for fromwire_query_channel_range */ -bool fromwire_query_channel_range(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, u32 *first_blocknum UNNEEDED, u32 *number_of_blocks UNNEEDED, struct tlv_query_channel_range_tlvs **tlvs UNNEEDED) -{ fprintf(stderr, "fromwire_query_channel_range called!\n"); abort(); } -/* Generated stub for fromwire_query_short_channel_ids */ -bool fromwire_query_short_channel_ids(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, u8 **encoded_short_ids UNNEEDED, struct tlv_query_short_channel_ids_tlvs **tlvs UNNEEDED) -{ fprintf(stderr, "fromwire_query_short_channel_ids called!\n"); abort(); } -/* Generated stub for fromwire_secp256k1_ecdsa_signature */ -void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "fromwire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for fromwire_sha256 */ -void fromwire_sha256(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "fromwire_sha256 called!\n"); abort(); } -/* Generated stub for fromwire_tal_arrn */ -u8 *fromwire_tal_arrn(const tal_t *ctx UNNEEDED, - const u8 **cursor UNNEEDED, size_t *max UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_tal_arrn called!\n"); abort(); } -/* Generated stub for fromwire_u16 */ -u16 fromwire_u16(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u16 called!\n"); abort(); } -/* Generated stub for fromwire_u32 */ -u32 fromwire_u32(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u32 called!\n"); abort(); } -/* Generated stub for fromwire_u64 */ -u64 fromwire_u64(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u64 called!\n"); abort(); } -/* Generated stub for fromwire_u8 */ -u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u8 called!\n"); abort(); } -/* Generated stub for fromwire_u8_array */ -void fromwire_u8_array(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_u8_array called!\n"); abort(); } /* Generated stub for get_gossmap */ struct gossmap *get_gossmap(struct daemon *daemon UNNEEDED) { fprintf(stderr, "get_gossmap called!\n"); abort(); } -/* Generated stub for gossmap_chan_byidx */ -struct gossmap_chan *gossmap_chan_byidx(const struct gossmap *map UNNEEDED, u32 idx UNNEEDED) -{ fprintf(stderr, "gossmap_chan_byidx called!\n"); abort(); } -/* Generated stub for gossmap_chan_get_announce */ -u8 *gossmap_chan_get_announce(const tal_t *ctx UNNEEDED, - const struct gossmap *map UNNEEDED, - const struct gossmap_chan *c UNNEEDED) -{ fprintf(stderr, "gossmap_chan_get_announce called!\n"); abort(); } -/* Generated stub for gossmap_chan_get_update */ -u8 *gossmap_chan_get_update(const tal_t *ctx UNNEEDED, - const struct gossmap *map UNNEEDED, - const struct gossmap_chan *chan UNNEEDED, - int dir UNNEEDED) -{ fprintf(stderr, "gossmap_chan_get_update called!\n"); abort(); } -/* Generated stub for gossmap_chan_get_update_details */ -void gossmap_chan_get_update_details(const struct gossmap *map UNNEEDED, - const struct gossmap_chan *chan UNNEEDED, - int dir UNNEEDED, - u32 *timestamp UNNEEDED, - u8 *message_flags UNNEEDED, - u8 *channel_flags UNNEEDED, - u16 *cltv_expiry_delta UNNEEDED, - u32 *fee_base_msat UNNEEDED, - u32 *fee_proportional_millionths UNNEEDED, - struct amount_msat *htlc_minimum_msat UNNEEDED, - struct amount_msat *htlc_maximum_msat UNNEEDED) -{ fprintf(stderr, "gossmap_chan_get_update_details called!\n"); abort(); } -/* Generated stub for gossmap_chan_scid */ -struct short_channel_id gossmap_chan_scid(const struct gossmap *map UNNEEDED, - const struct gossmap_chan *c UNNEEDED) -{ fprintf(stderr, "gossmap_chan_scid called!\n"); abort(); } -/* Generated stub for gossmap_find_chan */ -struct gossmap_chan *gossmap_find_chan(const struct gossmap *map UNNEEDED, - const struct short_channel_id *scid UNNEEDED) -{ fprintf(stderr, "gossmap_find_chan called!\n"); abort(); } -/* Generated stub for gossmap_find_node */ -struct gossmap_node *gossmap_find_node(const struct gossmap *map UNNEEDED, - const struct node_id *id UNNEEDED) -{ fprintf(stderr, "gossmap_find_node called!\n"); abort(); } -/* Generated stub for gossmap_max_chan_idx */ -u32 gossmap_max_chan_idx(const struct gossmap *map UNNEEDED) -{ fprintf(stderr, "gossmap_max_chan_idx called!\n"); abort(); } -/* Generated stub for gossmap_node_get_announce */ -u8 *gossmap_node_get_announce(const tal_t *ctx UNNEEDED, - const struct gossmap *map UNNEEDED, - const struct gossmap_node *n UNNEEDED) -{ fprintf(stderr, "gossmap_node_get_announce called!\n"); abort(); } -/* Generated stub for gossmap_node_get_id */ -void gossmap_node_get_id(const struct gossmap *map UNNEEDED, - const struct gossmap_node *node UNNEEDED, - struct node_id *id UNNEEDED) -{ fprintf(stderr, "gossmap_node_get_id called!\n"); abort(); } -/* Generated stub for gossmap_nth_node */ -struct gossmap_node *gossmap_nth_node(const struct gossmap *map UNNEEDED, - const struct gossmap_chan *chan UNNEEDED, - int n UNNEEDED) -{ fprintf(stderr, "gossmap_nth_node called!\n"); abort(); } /* Generated stub for inject_peer_msg */ void inject_peer_msg(struct peer *peer UNNEEDED, const u8 *msg TAKES UNNEEDED) { fprintf(stderr, "inject_peer_msg called!\n"); abort(); } -/* Generated stub for master_badmsg */ -void master_badmsg(u32 type_expected UNNEEDED, const u8 *msg) -{ fprintf(stderr, "master_badmsg called!\n"); abort(); } -/* Generated stub for node_id_cmp */ -int node_id_cmp(const struct node_id *a UNNEEDED, const struct node_id *b UNNEEDED) -{ fprintf(stderr, "node_id_cmp called!\n"); abort(); } -/* Generated stub for status_fmt */ -void status_fmt(enum log_level level UNNEEDED, - const struct node_id *peer UNNEEDED, - const char *fmt UNNEEDED, ...) - -{ fprintf(stderr, "status_fmt called!\n"); abort(); } -/* Generated stub for tlv_reply_channel_range_tlvs_new */ -struct tlv_reply_channel_range_tlvs *tlv_reply_channel_range_tlvs_new(const tal_t *ctx UNNEEDED) -{ fprintf(stderr, "tlv_reply_channel_range_tlvs_new called!\n"); abort(); } -/* Generated stub for towire */ -void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_bool */ -void towire_bool(u8 **pptr UNNEEDED, bool v UNNEEDED) -{ fprintf(stderr, "towire_bool called!\n"); abort(); } -/* Generated stub for towire_channel_update_timestamps */ -void towire_channel_update_timestamps(u8 **p UNNEEDED, const struct channel_update_timestamps *channel_update_timestamps UNNEEDED) -{ fprintf(stderr, "towire_channel_update_timestamps called!\n"); abort(); } -/* Generated stub for towire_reply_channel_range */ -u8 *towire_reply_channel_range(const tal_t *ctx UNNEEDED, const struct bitcoin_blkid *chain_hash UNNEEDED, u32 first_blocknum UNNEEDED, u32 number_of_blocks UNNEEDED, u8 sync_complete UNNEEDED, const u8 *encoded_short_ids UNNEEDED, const struct tlv_reply_channel_range_tlvs *tlvs UNNEEDED) -{ fprintf(stderr, "towire_reply_channel_range called!\n"); abort(); } -/* Generated stub for towire_reply_short_channel_ids_end */ -u8 *towire_reply_short_channel_ids_end(const tal_t *ctx UNNEEDED, const struct bitcoin_blkid *chain_hash UNNEEDED, u8 full_information UNNEEDED) -{ fprintf(stderr, "towire_reply_short_channel_ids_end called!\n"); abort(); } -/* Generated stub for towire_secp256k1_ecdsa_signature */ -void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED, - const secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "towire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for towire_sha256 */ -void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "towire_sha256 called!\n"); abort(); } -/* Generated stub for towire_u16 */ -void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED) -{ fprintf(stderr, "towire_u16 called!\n"); abort(); } -/* Generated stub for towire_u32 */ -void towire_u32(u8 **pptr UNNEEDED, u32 v UNNEEDED) -{ fprintf(stderr, "towire_u32 called!\n"); abort(); } -/* Generated stub for towire_u64 */ -void towire_u64(u8 **pptr UNNEEDED, u64 v UNNEEDED) -{ fprintf(stderr, "towire_u64 called!\n"); abort(); } -/* Generated stub for towire_u8 */ -void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) -{ fprintf(stderr, "towire_u8 called!\n"); abort(); } -/* Generated stub for towire_u8_array */ -void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "towire_u8_array called!\n"); abort(); } -/* Generated stub for towire_warningfmtv */ -u8 *towire_warningfmtv(const tal_t *ctx UNNEEDED, - const struct channel_id *channel UNNEEDED, - const char *fmt UNNEEDED, - va_list ap UNNEEDED) -{ fprintf(stderr, "towire_warningfmtv called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, char *argv[]) diff --git a/connectd/test/run-gossip_rcvd_filter.c b/connectd/test/run-gossip_rcvd_filter.c index ef20a1cd6839..3011917528bc 100644 --- a/connectd/test/run-gossip_rcvd_filter.c +++ b/connectd/test/run-gossip_rcvd_filter.c @@ -6,76 +6,8 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for towire */ -void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_bool */ -void towire_bool(u8 **pptr UNNEEDED, bool v UNNEEDED) -{ fprintf(stderr, "towire_bool called!\n"); abort(); } -/* Generated stub for towire_secp256k1_ecdsa_signature */ -void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED, - const secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "towire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for towire_sha256 */ -void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "towire_sha256 called!\n"); abort(); } -/* Generated stub for towire_u16 */ -void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED) -{ fprintf(stderr, "towire_u16 called!\n"); abort(); } -/* Generated stub for towire_u32 */ -void towire_u32(u8 **pptr UNNEEDED, u32 v UNNEEDED) -{ fprintf(stderr, "towire_u32 called!\n"); abort(); } -/* Generated stub for towire_u64 */ -void towire_u64(u8 **pptr UNNEEDED, u64 v UNNEEDED) -{ fprintf(stderr, "towire_u64 called!\n"); abort(); } -/* Generated stub for towire_u8 */ -void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) -{ fprintf(stderr, "towire_u8 called!\n"); abort(); } -/* Generated stub for towire_u8_array */ -void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "towire_u8_array called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ -void memleak_add_helper_(const tal_t *p UNNEEDED, - void (*cb)(struct htable *memtable, - const tal_t *) UNNEEDED) -{ -} - static u8 *mkgossip(const tal_t *ctx, const char *str) { return tal_hexdata(ctx, str, strlen(str)); diff --git a/connectd/test/run-initiator-success.c b/connectd/test/run-initiator-success.c index 26aeb40cceff..c083571f173a 100644 --- a/connectd/test/run-initiator-success.c +++ b/connectd/test/run-initiator-success.c @@ -14,103 +14,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for fromwire */ -const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) -{ fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_bool */ -bool fromwire_bool(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_bool called!\n"); abort(); } -/* Generated stub for fromwire_fail */ -void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_fail called!\n"); abort(); } -/* Generated stub for fromwire_secp256k1_ecdsa_signature */ -void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "fromwire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for fromwire_sha256 */ -void fromwire_sha256(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "fromwire_sha256 called!\n"); abort(); } -/* Generated stub for fromwire_tal_arrn */ -u8 *fromwire_tal_arrn(const tal_t *ctx UNNEEDED, - const u8 **cursor UNNEEDED, size_t *max UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_tal_arrn called!\n"); abort(); } -/* Generated stub for fromwire_u16 */ -u16 fromwire_u16(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u16 called!\n"); abort(); } -/* Generated stub for fromwire_u32 */ -u32 fromwire_u32(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u32 called!\n"); abort(); } -/* Generated stub for fromwire_u64 */ -u64 fromwire_u64(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u64 called!\n"); abort(); } -/* Generated stub for fromwire_u8 */ -u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u8 called!\n"); abort(); } -/* Generated stub for fromwire_u8_array */ -void fromwire_u8_array(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_u8_array called!\n"); abort(); } -/* Generated stub for towire */ -void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_bool */ -void towire_bool(u8 **pptr UNNEEDED, bool v UNNEEDED) -{ fprintf(stderr, "towire_bool called!\n"); abort(); } -/* Generated stub for towire_secp256k1_ecdsa_signature */ -void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED, - const secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "towire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for towire_sha256 */ -void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "towire_sha256 called!\n"); abort(); } -/* Generated stub for towire_u16 */ -void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED) -{ fprintf(stderr, "towire_u16 called!\n"); abort(); } -/* Generated stub for towire_u32 */ -void towire_u32(u8 **pptr UNNEEDED, u32 v UNNEEDED) -{ fprintf(stderr, "towire_u32 called!\n"); abort(); } -/* Generated stub for towire_u64 */ -void towire_u64(u8 **pptr UNNEEDED, u64 v UNNEEDED) -{ fprintf(stderr, "towire_u64 called!\n"); abort(); } -/* Generated stub for towire_u8 */ -void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) -{ fprintf(stderr, "towire_u8 called!\n"); abort(); } -/* Generated stub for towire_u8_array */ -void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "towire_u8_array called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ /* No randomness please, we want to replicate test vectors. */ diff --git a/connectd/test/run-netaddress.c b/connectd/test/run-netaddress.c index c69ed2510325..889ef887d401 100644 --- a/connectd/test/run-netaddress.c +++ b/connectd/test/run-netaddress.c @@ -13,145 +13,6 @@ #define DEFAULT_PORT 9735 /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for b32_decode */ -u8 *b32_decode(const tal_t *ctx UNNEEDED, const char *str UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "b32_decode called!\n"); abort(); } -/* Generated stub for b32_encode */ -char *b32_encode(const tal_t *ctx UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "b32_encode called!\n"); abort(); } -/* Generated stub for daemon_conn_send */ -void daemon_conn_send(struct daemon_conn *dc UNNEEDED, const u8 *msg UNNEEDED) -{ fprintf(stderr, "daemon_conn_send called!\n"); abort(); } -/* Generated stub for daemon_conn_sync_flush */ -bool daemon_conn_sync_flush(struct daemon_conn *dc UNNEEDED) -{ fprintf(stderr, "daemon_conn_sync_flush called!\n"); abort(); } -/* Generated stub for fromwire */ -const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) -{ fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_bool */ -bool fromwire_bool(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_bool called!\n"); abort(); } -/* Generated stub for fromwire_fail */ -void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_fail called!\n"); abort(); } -/* Generated stub for fromwire_peektype */ -int fromwire_peektype(const u8 *cursor UNNEEDED) -{ fprintf(stderr, "fromwire_peektype called!\n"); abort(); } -/* Generated stub for fromwire_secp256k1_ecdsa_signature */ -void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "fromwire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for fromwire_sha256 */ -void fromwire_sha256(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "fromwire_sha256 called!\n"); abort(); } -/* Generated stub for fromwire_tal_arrn */ -u8 *fromwire_tal_arrn(const tal_t *ctx UNNEEDED, - const u8 **cursor UNNEEDED, size_t *max UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_tal_arrn called!\n"); abort(); } -/* Generated stub for fromwire_u16 */ -u16 fromwire_u16(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u16 called!\n"); abort(); } -/* Generated stub for fromwire_u32 */ -u32 fromwire_u32(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u32 called!\n"); abort(); } -/* Generated stub for fromwire_u64 */ -u64 fromwire_u64(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u64 called!\n"); abort(); } -/* Generated stub for fromwire_u8 */ -u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u8 called!\n"); abort(); } -/* Generated stub for fromwire_u8_array */ -void fromwire_u8_array(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_u8_array called!\n"); abort(); } -/* Generated stub for is_msg_for_gossipd */ -bool is_msg_for_gossipd(const u8 *cursor UNNEEDED) -{ fprintf(stderr, "is_msg_for_gossipd called!\n"); abort(); } -/* Generated stub for peer_wire_name */ -const char *peer_wire_name(int e UNNEEDED) -{ fprintf(stderr, "peer_wire_name called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace called!\n"); abort(); } -/* Generated stub for towire */ -void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_bool */ -void towire_bool(u8 **pptr UNNEEDED, bool v UNNEEDED) -{ fprintf(stderr, "towire_bool called!\n"); abort(); } -/* Generated stub for towire_secp256k1_ecdsa_signature */ -void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED, - const secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "towire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for towire_sha256 */ -void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "towire_sha256 called!\n"); abort(); } -/* Generated stub for towire_status_fail */ -u8 *towire_status_fail(const tal_t *ctx UNNEEDED, enum status_failreason failreason UNNEEDED, const wirestring *desc UNNEEDED) -{ fprintf(stderr, "towire_status_fail called!\n"); abort(); } -/* Generated stub for towire_status_io */ -u8 *towire_status_io(const tal_t *ctx UNNEEDED, enum log_level iodir UNNEEDED, const struct node_id *peer UNNEEDED, const wirestring *who UNNEEDED, const u8 *data UNNEEDED) -{ fprintf(stderr, "towire_status_io called!\n"); abort(); } -/* Generated stub for towire_status_log */ -u8 *towire_status_log(const tal_t *ctx UNNEEDED, enum log_level level UNNEEDED, const struct node_id *peer UNNEEDED, const wirestring *entry UNNEEDED) -{ fprintf(stderr, "towire_status_log called!\n"); abort(); } -/* Generated stub for towire_status_version */ -u8 *towire_status_version(const tal_t *ctx UNNEEDED, const wirestring *version UNNEEDED) -{ fprintf(stderr, "towire_status_version called!\n"); abort(); } -/* Generated stub for towire_u16 */ -void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED) -{ fprintf(stderr, "towire_u16 called!\n"); abort(); } -/* Generated stub for towire_u32 */ -void towire_u32(u8 **pptr UNNEEDED, u32 v UNNEEDED) -{ fprintf(stderr, "towire_u32 called!\n"); abort(); } -/* Generated stub for towire_u64 */ -void towire_u64(u8 **pptr UNNEEDED, u64 v UNNEEDED) -{ fprintf(stderr, "towire_u64 called!\n"); abort(); } -/* Generated stub for towire_u8 */ -void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) -{ fprintf(stderr, "towire_u8 called!\n"); abort(); } -/* Generated stub for towire_u8_array */ -void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "towire_u8_array called!\n"); abort(); } -/* Generated stub for version */ -const char *version(void) -{ fprintf(stderr, "version called!\n"); abort(); } -/* Generated stub for wire_sync_write */ -bool wire_sync_write(int fd UNNEEDED, const void *msg TAKES UNNEEDED) -{ fprintf(stderr, "wire_sync_write called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, char *argv[]) diff --git a/connectd/test/run-responder-success.c b/connectd/test/run-responder-success.c index ed1dfb175e35..881c63c4b745 100644 --- a/connectd/test/run-responder-success.c +++ b/connectd/test/run-responder-success.c @@ -14,103 +14,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for fromwire */ -const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) -{ fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_bool */ -bool fromwire_bool(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_bool called!\n"); abort(); } -/* Generated stub for fromwire_fail */ -void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_fail called!\n"); abort(); } -/* Generated stub for fromwire_secp256k1_ecdsa_signature */ -void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "fromwire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for fromwire_sha256 */ -void fromwire_sha256(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "fromwire_sha256 called!\n"); abort(); } -/* Generated stub for fromwire_tal_arrn */ -u8 *fromwire_tal_arrn(const tal_t *ctx UNNEEDED, - const u8 **cursor UNNEEDED, size_t *max UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_tal_arrn called!\n"); abort(); } -/* Generated stub for fromwire_u16 */ -u16 fromwire_u16(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u16 called!\n"); abort(); } -/* Generated stub for fromwire_u32 */ -u32 fromwire_u32(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u32 called!\n"); abort(); } -/* Generated stub for fromwire_u64 */ -u64 fromwire_u64(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u64 called!\n"); abort(); } -/* Generated stub for fromwire_u8 */ -u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u8 called!\n"); abort(); } -/* Generated stub for fromwire_u8_array */ -void fromwire_u8_array(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_u8_array called!\n"); abort(); } -/* Generated stub for towire */ -void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_bool */ -void towire_bool(u8 **pptr UNNEEDED, bool v UNNEEDED) -{ fprintf(stderr, "towire_bool called!\n"); abort(); } -/* Generated stub for towire_secp256k1_ecdsa_signature */ -void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED, - const secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "towire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for towire_sha256 */ -void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "towire_sha256 called!\n"); abort(); } -/* Generated stub for towire_u16 */ -void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED) -{ fprintf(stderr, "towire_u16 called!\n"); abort(); } -/* Generated stub for towire_u32 */ -void towire_u32(u8 **pptr UNNEEDED, u32 v UNNEEDED) -{ fprintf(stderr, "towire_u32 called!\n"); abort(); } -/* Generated stub for towire_u64 */ -void towire_u64(u8 **pptr UNNEEDED, u64 v UNNEEDED) -{ fprintf(stderr, "towire_u64 called!\n"); abort(); } -/* Generated stub for towire_u8 */ -void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) -{ fprintf(stderr, "towire_u8 called!\n"); abort(); } -/* Generated stub for towire_u8_array */ -void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "towire_u8_array called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ /* No randomness please, we want to replicate test vectors. */ diff --git a/connectd/test/run-websocket.c b/connectd/test/run-websocket.c index 25f126e927d2..809618dfc66c 100644 --- a/connectd/test/run-websocket.c +++ b/connectd/test/run-websocket.c @@ -49,103 +49,6 @@ int websocket_main(int argc, char *argv[]); #undef main /* AUTOGENERATED MOCKS START */ -/* Generated stub for amount_asset_is_main */ -bool amount_asset_is_main(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_is_main called!\n"); abort(); } -/* Generated stub for amount_asset_to_sat */ -struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) -{ fprintf(stderr, "amount_asset_to_sat called!\n"); abort(); } -/* Generated stub for amount_feerate */ - bool amount_feerate(u32 *feerate UNNEEDED, struct amount_sat fee UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_feerate called!\n"); abort(); } -/* Generated stub for amount_sat */ -struct amount_sat amount_sat(u64 satoshis UNNEEDED) -{ fprintf(stderr, "amount_sat called!\n"); abort(); } -/* Generated stub for amount_sat_add */ - bool amount_sat_add(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } -/* Generated stub for amount_sat_greater_eq */ -bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } -/* Generated stub for amount_sat_sub */ - bool amount_sat_sub(struct amount_sat *val UNNEEDED, - struct amount_sat a UNNEEDED, - struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_sub called!\n"); abort(); } -/* Generated stub for amount_sat_to_asset */ -struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u8 *asset UNNEEDED) -{ fprintf(stderr, "amount_sat_to_asset called!\n"); abort(); } -/* Generated stub for amount_tx_fee */ -struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED) -{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); } -/* Generated stub for fromwire */ -const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) -{ fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_bool */ -bool fromwire_bool(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_bool called!\n"); abort(); } -/* Generated stub for fromwire_fail */ -void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_fail called!\n"); abort(); } -/* Generated stub for fromwire_secp256k1_ecdsa_signature */ -void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "fromwire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for fromwire_sha256 */ -void fromwire_sha256(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "fromwire_sha256 called!\n"); abort(); } -/* Generated stub for fromwire_tal_arrn */ -u8 *fromwire_tal_arrn(const tal_t *ctx UNNEEDED, - const u8 **cursor UNNEEDED, size_t *max UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_tal_arrn called!\n"); abort(); } -/* Generated stub for fromwire_u16 */ -u16 fromwire_u16(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u16 called!\n"); abort(); } -/* Generated stub for fromwire_u32 */ -u32 fromwire_u32(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u32 called!\n"); abort(); } -/* Generated stub for fromwire_u64 */ -u64 fromwire_u64(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u64 called!\n"); abort(); } -/* Generated stub for fromwire_u8 */ -u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u8 called!\n"); abort(); } -/* Generated stub for fromwire_u8_array */ -void fromwire_u8_array(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_u8_array called!\n"); abort(); } -/* Generated stub for towire */ -void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_bool */ -void towire_bool(u8 **pptr UNNEEDED, bool v UNNEEDED) -{ fprintf(stderr, "towire_bool called!\n"); abort(); } -/* Generated stub for towire_secp256k1_ecdsa_signature */ -void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED, - const secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "towire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for towire_sha256 */ -void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "towire_sha256 called!\n"); abort(); } -/* Generated stub for towire_u16 */ -void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED) -{ fprintf(stderr, "towire_u16 called!\n"); abort(); } -/* Generated stub for towire_u32 */ -void towire_u32(u8 **pptr UNNEEDED, u32 v UNNEEDED) -{ fprintf(stderr, "towire_u32 called!\n"); abort(); } -/* Generated stub for towire_u64 */ -void towire_u64(u8 **pptr UNNEEDED, u64 v UNNEEDED) -{ fprintf(stderr, "towire_u64 called!\n"); abort(); } -/* Generated stub for towire_u8 */ -void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) -{ fprintf(stderr, "towire_u8 called!\n"); abort(); } -/* Generated stub for towire_u8_array */ -void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "towire_u8_array called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, char *argv[]) diff --git a/connectd/websocketd.c b/connectd/websocketd.c index 782530426069..d139199f6553 100644 --- a/connectd/websocketd.c +++ b/connectd/websocketd.c @@ -8,15 +8,10 @@ #include #include #include -#include #include #include #include #include -#include -#include -#include -#include /* 0 1 2 3 diff --git a/db/bindings.c b/db/bindings.c index ceb251f304c8..8dac3ea6ebed 100644 --- a/db/bindings.c +++ b/db/bindings.c @@ -2,12 +2,9 @@ #include #include #include -#include #include -#include #include #include -#include #include #include #include diff --git a/db/common.h b/db/common.h index 1ffd26344e4f..829a3d2cf932 100644 --- a/db/common.h +++ b/db/common.h @@ -2,11 +2,8 @@ #define LIGHTNING_DB_COMMON_H #include "config.h" #include -#include -#include #include #include -#include /** * Macro to annotate a named SQL query. diff --git a/db/db_sqlite3.c b/db/db_sqlite3.c index c34acc51ca5e..5df248b6fadb 100644 --- a/db/db_sqlite3.c +++ b/db/db_sqlite3.c @@ -1,7 +1,5 @@ #include "config.h" #include -#include -#include #include #include #include diff --git a/db/exec.c b/db/exec.c index c6e64718207c..5ab6e9b0403f 100644 --- a/db/exec.c +++ b/db/exec.c @@ -1,5 +1,4 @@ #include "config.h" -#include #include #include #include diff --git a/db/utils.c b/db/utils.c index 155efbd44cc7..25bce2f4f003 100644 --- a/db/utils.c +++ b/db/utils.c @@ -1,7 +1,7 @@ #include "config.h" +#include #include #include -#include #include #include diff --git a/devtools/Makefile b/devtools/Makefile index 606279146942..a61f3c3d0874 100644 --- a/devtools/Makefile +++ b/devtools/Makefile @@ -16,94 +16,20 @@ ifeq ($(HAVE_ZLIB),1) devtools/gossmap-compress_LDLIBS=-lz endif # ZLIB -DEVTOOLS_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/blinding.o \ - common/blindedpath.o \ - common/coin_mvt.o \ - common/base32.o \ - common/bech32.o \ - common/bech32_util.o \ - common/bigsize.o \ - common/bolt11.o \ - common/blockheight_states.o \ - common/channel_id.o \ - common/decode_array.o \ - common/features.o \ - common/fee_states.o \ - common/hash_u5.o \ - common/hmac.o \ - common/htlc_state.o \ - common/json_parse.o \ - common/json_parse_simple.o \ - common/memleak.o \ - common/node_id.o \ - common/per_peer_state.o \ - common/psbt_open.o \ - common/pseudorand.o \ - common/sciddir_or_pubkey.o \ - common/setup.o \ - common/utils.o \ - common/version.o \ - common/wireaddr.o \ - wire/onion_wiregen.o \ - wire/peer_wiregen.o \ - wire/channel_type_wiregen.o \ - wire/tlvstream.o +$(DEVTOOLS): %: %.o libcommon.a +$(DEVTOOLS_TOOL_OBJS): wire/wire.h -devtools/features: common/features.o common/utils.o wire/fromwire.o wire/towire.o devtools/features.o +# Some devtools require extra objects +DEVTOOLS_NEEDS_GOSSIP_STORE := devtools/gossmap-compress devtools/dump-gossipstore devtools/convert-gossmap devtools/create-gossipstore -devtools/rune: common/utils.o common/autodata.o common/setup.o common/version.o wire/fromwire.o wire/towire.o devtools/rune.o +$(DEVTOOLS_NEEDS_GOSSIP_STORE): gossipd/gossip_store_wiregen.o +$(DEVTOOLS_NEEDS_GOSSIP_STORE:=.o): gossipd/gossip_store_wiregen.h -devtools/fp16: common/fp16.o common/utils.o common/setup.o common/autodata.o devtools/fp16.o +devtools/decodemsg: devtools/print_wire.o +devtools/decodemsg.o: devtools/print_wire.h -devtools/bolt11-cli: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/bolt11-cli.o +devtools/mkcommit: channeld/full_channel.o channeld/commit_tx.o +devtools/mkcommit.o: channeld/full_channel.h channeld/commit_tx.h -devtools/encodeaddr: common/utils.o common/bech32.o devtools/encodeaddr.o - -devtools/gossmap-compress: $(DEVTOOLS_COMMON_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/tlvstream.o common/gossmap.o common/fp16.o devtools/gossmap-compress.o gossipd/gossip_store_wiregen.o - -devtools/bolt12-cli: $(DEVTOOLS_COMMON_OBJS) $(BITCOIN_OBJS) wire/bolt12_wiregen.o wire/fromwire.o wire/towire.o common/bolt12.o common/bolt12_merkle.o devtools/bolt12-cli.o common/setup.o common/iso4217.o - -devtools/decodemsg: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(BITCOIN_OBJS) $(WIRE_PRINT_OBJS) wire/fromwire.o wire/towire.o devtools/print_wire.o devtools/decodemsg.o - -devtools/dump-gossipstore: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/dump-gossipstore.o gossipd/gossip_store_wiregen.o - -devtools/dump-gossipstore.o: gossipd/gossip_store_wiregen.h - -devtools/convert-gossmap: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/convert-gossmap.o -devtools/convert-gossmap.o: gossipd/gossip_store_wiregen.h - -devtools/create-gossipstore: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/create-gossipstore.o gossipd/gossip_store_wiregen.o -devtools/create-gossipstore.o: gossipd/gossip_store_wiregen.h - -devtools/onion.c: ccan/config.h - -devtools/onion: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(BITCOIN_OBJS) common/onion_decode.o common/onion_encode.o common/onionreply.o wire/fromwire.o wire/towire.o devtools/onion.o common/sphinx.o - -devtools/gossipwith: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/peer_wiregen.o devtools/gossipwith.o common/cryptomsg.o common/ping.o - -$(DEVTOOLS_OBJS) $(DEVTOOLS_TOOL_OBJS): wire/wire.h - -devtools/mkcommit: $(DEVTOOLS_COMMON_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) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o common/key_derive.o devtools/mkfunding.o - -devtools/mkclose: $(DEVTOOLS_COMMON_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/mkclose.o - -devtools/mkgossip: $(DEVTOOLS_COMMON_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o common/utxo.o common/permute_tx.o common/key_derive.o devtools/mkgossip.o - -devtools/mkencoded: $(DEVTOOLS_COMMON_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/mkencoded.o - -devtools/checkchannels: $(DEVTOOLS_COMMON_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/checkchannels.o common/configdir.o common/configvar.o - -devtools/mkquery: $(DEVTOOLS_COMMON_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/mkquery.o - -devtools/lightning-checkmessage: $(DEVTOOLS_COMMON_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/lightning-checkmessage.o - -devtools/bip137-verifysignature: $(DEVTOOLS_COMMON_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/bip137-verifysignature.o - -devtools/route: $(DEVTOOLS_COMMON_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/tlvstream.o common/gossmap.o common/fp16.o common/random_select.o common/route.o common/dijkstra.o devtools/clean_topo.o devtools/route.o - -devtools/topology: $(DEVTOOLS_COMMON_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/tlvstream.o common/gossmap.o common/fp16.o common/random_select.o common/dijkstra.o common/route.o devtools/clean_topo.o devtools/topology.o +devtools/route devtools/topology: devtools/clean_topo.o +devtools/route.o devtools/topology.o: devtools/clean_topo.h diff --git a/devtools/bip137-verifysignature.c b/devtools/bip137-verifysignature.c index 48db7b95db55..761f6ce63384 100644 --- a/devtools/bip137-verifysignature.c +++ b/devtools/bip137-verifysignature.c @@ -1,8 +1,5 @@ #include "config.h" -#include -#include #include -#include #include #include #include diff --git a/devtools/bolt11-cli.c b/devtools/bolt11-cli.c index 5553822c6738..02204fb15b44 100644 --- a/devtools/bolt11-cli.c +++ b/devtools/bolt11-cli.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/devtools/bolt12-cli.c b/devtools/bolt12-cli.c index 830d2744a6e8..9d8e0b6e2c9f 100644 --- a/devtools/bolt12-cli.c +++ b/devtools/bolt12-cli.c @@ -1,5 +1,4 @@ #include "config.h" -#include #include #include #include @@ -7,13 +6,12 @@ #include #include #include -#include #include #include #include +#include #include #include -#include #include #include diff --git a/devtools/checkchannels.c b/devtools/checkchannels.c index bf7746d08f5f..144646f3a9ed 100644 --- a/devtools/checkchannels.c +++ b/devtools/checkchannels.c @@ -5,12 +5,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include diff --git a/devtools/convert-gossmap.c b/devtools/convert-gossmap.c index dee2b1f1e6af..c5ee23c9dfc9 100644 --- a/devtools/convert-gossmap.c +++ b/devtools/convert-gossmap.c @@ -1,13 +1,10 @@ /* Tool we can use to convert our testing gossip_store files */ #include "config.h" -#include #include -#include #include #include -#include +#include #include -#include #include #include diff --git a/devtools/create-gossipstore.c b/devtools/create-gossipstore.c index b9376f4742ff..320ad9f37e1a 100644 --- a/devtools/create-gossipstore.c +++ b/devtools/create-gossipstore.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include diff --git a/devtools/decodemsg.c b/devtools/decodemsg.c index 2a5d05c7efe9..390a40930861 100644 --- a/devtools/decodemsg.c +++ b/devtools/decodemsg.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include diff --git a/devtools/dump-gossipstore.c b/devtools/dump-gossipstore.c index ced6a5a06ce0..2d69b0637040 100644 --- a/devtools/dump-gossipstore.c +++ b/devtools/dump-gossipstore.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include diff --git a/devtools/fp16.c b/devtools/fp16.c index abf1947edfe9..81791b3eebee 100644 --- a/devtools/fp16.c +++ b/devtools/fp16.c @@ -1,6 +1,5 @@ /* Simple tool to convert to/from our internal fp16 representation */ #include "config.h" -#include #include #include #include diff --git a/devtools/gossipwith.c b/devtools/gossipwith.c index f506787cd4e3..a0e55ab996cb 100644 --- a/devtools/gossipwith.c +++ b/devtools/gossipwith.c @@ -1,7 +1,5 @@ /* Simple tool to route gossip from a peer. */ #include "config.h" -#include -#include #include #include #include @@ -9,16 +7,12 @@ #include #include #include +#include #include #include -#include -#include #include -#include #include #include -#include -#include #include #include diff --git a/devtools/gossmap-compress.c b/devtools/gossmap-compress.c index 0847fc1bff69..191a9ff286bc 100644 --- a/devtools/gossmap-compress.c +++ b/devtools/gossmap-compress.c @@ -1,23 +1,19 @@ #include "config.h" -#include -#include #include -#include #include #include #include #include #include #include -#include #include #include #include +#include #include #include #include #include -#include #include #if HAVE_ZLIB #include diff --git a/devtools/mkcommit.c b/devtools/mkcommit.c index 069282b2f343..48494ac79819 100644 --- a/devtools/mkcommit.c +++ b/devtools/mkcommit.c @@ -9,7 +9,6 @@ 0000000000000000000000000000000000000000000000000000000000000010 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 0000000000000000000000000000000000000000000000000000000000000011 0000000000000000000000000000000000000000000000000000000000000012 0000000000000000000000000000000000000000000000000000000000000013 0000000000000000000000000000000000000000000000000000000000000014 */ #include "config.h" -#include #include #include #include @@ -23,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/devtools/mkencoded.c b/devtools/mkencoded.c index 6ff556be98c3..ba6f40db1c60 100644 --- a/devtools/mkencoded.c +++ b/devtools/mkencoded.c @@ -4,6 +4,7 @@ #include #include #include +#include #include static NORETURN void usage(void) diff --git a/devtools/mkgossip.c b/devtools/mkgossip.c index 374b914271eb..b68d8cfe6c91 100644 --- a/devtools/mkgossip.c +++ b/devtools/mkgossip.c @@ -8,11 +8,13 @@ */ #include "config.h" #include +#include #include #include #include #include #include +#include #include #include #include diff --git a/devtools/mkquery.c b/devtools/mkquery.c index 3bb4cef7a2e0..9fe6e69f858c 100644 --- a/devtools/mkquery.c +++ b/devtools/mkquery.c @@ -2,6 +2,7 @@ #include "config.h" #include #include +#include #include #include diff --git a/devtools/onion.c b/devtools/onion.c index ca723afd5a9d..461494af0e8b 100644 --- a/devtools/onion.c +++ b/devtools/onion.c @@ -7,9 +7,9 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/devtools/print_wire.c b/devtools/print_wire.c index 15669899dd95..a99a49559d5d 100644 --- a/devtools/print_wire.c +++ b/devtools/print_wire.c @@ -1,8 +1,12 @@ #include "config.h" +#include +#include +#include #include #include +#include #include -#include +#include #include #include #include diff --git a/devtools/print_wire.h b/devtools/print_wire.h index 40c86d23578a..0a2a1379779f 100644 --- a/devtools/print_wire.h +++ b/devtools/print_wire.h @@ -1,11 +1,7 @@ #ifndef LIGHTNING_DEVTOOLS_PRINT_WIRE_H #define LIGHTNING_DEVTOOLS_PRINT_WIRE_H #include "config.h" -#include -#include -#include -#include -#include +#include struct tlv_print_record_type { u64 type; diff --git a/devtools/reduce-includes.sh b/devtools/reduce-includes.sh index 81e4f8770c3e..877f17decf03 100755 --- a/devtools/reduce-includes.sh +++ b/devtools/reduce-includes.sh @@ -7,11 +7,13 @@ fi CCMD=$(make show-flags | sed -n 's/CC://p') for file; do + # We have a rule (and a check!) that a .c includes its own .h directly. + OWN_HDR='<'$(echo "$file" | sed -n 's/\.c$/.h/p')'>' i=1 echo "$file": while true; do # Don't eliminate config.h includes! - LINE="$(grep '^#include <' "$file" | grep -v '[<"]config.h[">]' | tail -n +$i | head -n1)" + LINE="$(grep '^#include <' "$file" | grep -v '[<"]config.h[">]' | grep -F -v "$OWN_HDR" | tail -n +$i | head -n1)" [ -n "$LINE" ] || break # Make sure even headers end in .c grep -F -v "$LINE" "$file" > "$file".c diff --git a/devtools/route.c b/devtools/route.c index 684d04cb7a10..d13e3cf9d3ee 100644 --- a/devtools/route.c +++ b/devtools/route.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/devtools/rune.c b/devtools/rune.c index 37322e06c475..a534dec8eec9 100644 --- a/devtools/rune.c +++ b/devtools/rune.c @@ -1,11 +1,8 @@ /* Decodes a rune. */ #include "config.h" -#include #include #include -#include #include -#include #include #include diff --git a/devtools/topology.c b/devtools/topology.c index 649e669537d0..181809d22dc3 100644 --- a/devtools/topology.c +++ b/devtools/topology.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/gossipd/Makefile b/gossipd/Makefile index c0732482d75f..1ee7a2756b5e 100644 --- a/gossipd/Makefile +++ b/gossipd/Makefile @@ -24,52 +24,7 @@ ALL_PROGRAMS += lightningd/lightning_gossipd LIGHTNINGD_CONTROL_HEADERS += gossipd/gossipd_wiregen.h LIGHTNINGD_CONTROL_OBJS += gossipd/gossipd_wiregen.o -# Common source we use. -GOSSIPD_COMMON_OBJS := \ - bitcoin/chainparams.o \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/bech32.o \ - common/bech32_util.o \ - common/bigsize.o \ - common/bip32.o \ - common/channel_id.o \ - common/cryptomsg.o \ - common/daemon.o \ - common/daemon_conn.o \ - common/decode_array.o \ - common/derive_basepoints.o \ - common/dev_disconnect.o \ - common/ecdh_hsmd.o \ - common/features.o \ - common/gossmap.o \ - common/fp16.o \ - common/status_wiregen.o \ - common/key_derive.o \ - common/lease_rates.o \ - common/memleak.o \ - common/msg_queue.o \ - common/node_id.o \ - common/onionreply.o \ - common/per_peer_state.o \ - common/ping.o \ - common/psbt_open.o \ - common/pseudorand.o \ - common/random_select.o \ - common/setup.o \ - common/status.o \ - common/status_wire.o \ - common/subdaemon.o \ - common/timeout.o \ - common/utils.o \ - common/utxo.o \ - common/version.o \ - common/wireaddr.o \ - common/wire_error.o \ - connectd/connectd_gossipd_wiregen.o - -lightningd/lightning_gossipd: $(GOSSIPD_OBJS) $(GOSSIPD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(HSMD_CLIENT_OBJS) +lightningd/lightning_gossipd: $(GOSSIPD_OBJS) $(HSMD_CLIENT_OBJS) connectd/connectd_gossipd_wiregen.o libcommon.a # The CSV was removed, but the generated files may live on! clean: clean-old-gossip-gen diff --git a/gossipd/gossip_store.c b/gossipd/gossip_store.c index 15cae6bdecc9..21436251407f 100644 --- a/gossipd/gossip_store.c +++ b/gossipd/gossip_store.c @@ -1,22 +1,19 @@ #include "config.h" -#include #include #include #include #include #include #include +#include #include #include #include #include #include -#include #include #include -#include #include -#include /* Obsolete ZOMBIE bit */ #define GOSSIP_STORE_ZOMBIE_BIT_V13 0x1000U diff --git a/gossipd/gossip_store.h b/gossipd/gossip_store.h index 96ff0937f77d..853b772d772a 100644 --- a/gossipd/gossip_store.h +++ b/gossipd/gossip_store.h @@ -4,9 +4,6 @@ #include "config.h" #include -#include -#include -#include /** * gossip_store -- On-disk storage related information diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index 41807050806f..18166adbc52d 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -11,28 +11,21 @@ * add complexity to this daemon. */ #include "config.h" -#include #include #include #include -#include #include -#include #include #include #include +#include #include -#include #include -#include -#include -#include #include #include #include #include #include -#include const struct node_id *peer_node_id(const struct peer *peer) { diff --git a/gossipd/gossipd.h b/gossipd/gossipd.h index 8318156348dc..9ee193e55aef 100644 --- a/gossipd/gossipd.h +++ b/gossipd/gossipd.h @@ -2,6 +2,7 @@ #define LIGHTNING_GOSSIPD_GOSSIPD_H #include "config.h" #include +#include #include #include #include diff --git a/gossipd/gossipd_wire.csv b/gossipd/gossipd_wire.csv index d8bee4b298bb..c5868eb74843 100644 --- a/gossipd/gossipd_wire.csv +++ b/gossipd/gossipd_wire.csv @@ -2,7 +2,7 @@ #include #include #include -#include +#include # Initialize the gossip daemon. msgtype,gossipd_init,3000 diff --git a/gossipd/gossmap_manage.c b/gossipd/gossmap_manage.c index 816c3f00eaa9..bf4faee561aa 100644 --- a/gossipd/gossmap_manage.c +++ b/gossipd/gossmap_manage.c @@ -1,7 +1,6 @@ #include "config.h" #include #include -#include #include #include #include @@ -9,9 +8,8 @@ #include #include #include +#include #include -#include -#include #include #include #include @@ -20,7 +18,6 @@ #include #include #include -#include struct pending_cannounce { const u8 *scriptpubkey; diff --git a/gossipd/queries.c b/gossipd/queries.c index 707933fac793..e106f47dfef6 100644 --- a/gossipd/queries.c +++ b/gossipd/queries.c @@ -1,18 +1,10 @@ /* Routines to generate gossip query messages */ #include "config.h" -#include -#include -#include -#include -#include #include -#include #include +#include #include -#include #include -#include -#include #include /* BOLT #7: diff --git a/gossipd/seeker.c b/gossipd/seeker.c index 414aa3e73626..4ba862e93c6b 100644 --- a/gossipd/seeker.c +++ b/gossipd/seeker.c @@ -1,7 +1,5 @@ /* This contains the code which actively seeks out gossip from peers */ #include "config.h" -#include -#include #include #include #include @@ -9,10 +7,9 @@ #include #include #include -#include -#include #include #include +#include #include #include #include diff --git a/gossipd/sigcheck.c b/gossipd/sigcheck.c index 8897586a074b..9e729c1123f7 100644 --- a/gossipd/sigcheck.c +++ b/gossipd/sigcheck.c @@ -3,7 +3,6 @@ #include #include #include -#include #include /* Verify the signature of a channel_update message */ diff --git a/gossipd/test/Makefile b/gossipd/test/Makefile index 99cb7faafd3f..a05e4fda29c7 100644 --- a/gossipd/test/Makefile +++ b/gossipd/test/Makefile @@ -6,48 +6,12 @@ GOSSIPD_TEST_SRC := $(wildcard gossipd/test/run-*.c) GOSSIPD_TEST_OBJS := $(GOSSIPD_TEST_SRC:.c=.o) GOSSIPD_TEST_PROGRAMS := $(GOSSIPD_TEST_OBJS:.o=) -GOSSIPD_TEST_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/coin_mvt.o \ - common/bigsize.o \ - common/blindedpath.o \ - common/channel_id.o \ - common/features.o \ - common/hmac.o \ - common/node_id.o \ - common/lease_rates.o \ - common/pseudorand.o \ - common/setup.o \ - common/utils.o \ - common/wireaddr.o \ - gossipd/gossip_store_wiregen.o \ - wire/peer_wiregen.o \ - wire/onion_wiregen.o \ - wire/fromwire.o \ - wire/tlvstream.o \ - wire/towire.o - ALL_C_SOURCES += $(GOSSIPD_TEST_SRC) ALL_TEST_PROGRAMS += $(GOSSIPD_TEST_PROGRAMS) -# Extra stuff needed for onion tests -gossipd/test/run-onion_message: \ - wire/onion_wiregen.o \ - common/blindedpath.o \ - common/blinding.o \ - common/hmac.o \ - common/sphinx.o \ - -# JSON needed for this test -gossipd/test/run-extended-info: \ - common/json_parse.o \ - common/json_parse_simple.o - -$(GOSSIPD_TEST_PROGRAMS): $(GOSSIPD_TEST_COMMON_OBJS) $(BITCOIN_OBJS) +$(GOSSIPD_TEST_PROGRAMS): libcommon.a # Test objects depend on ../ src and headers. -$(GOSSIPD_TEST_OBJS): $(GOSSIPD_HEADERS) $(GOSSIPD_SRC) +$(GOSSIPD_TEST_OBJS): $(GOSSIPD_HEADERS) $(GOSSIPD_SRC) gossipd/test/Makefile gossipd-tests: $(GOSSIPD_TEST_PROGRAMS:%=unittest/%) diff --git a/gossipd/test/run-check_channel_announcement.c b/gossipd/test/run-check_channel_announcement.c index 6c743d4d9871..b16b887fec4a 100644 --- a/gossipd/test/run-check_channel_announcement.c +++ b/gossipd/test/run-check_channel_announcement.c @@ -41,29 +41,6 @@ In particular, we set feature bit 19. The spec says we should set feature bit 1 #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for blinding_hash_e_and_ss */ -void blinding_hash_e_and_ss(const struct pubkey *e UNNEEDED, - const struct secret *ss UNNEEDED, - struct sha256 *sha UNNEEDED) -{ fprintf(stderr, "blinding_hash_e_and_ss called!\n"); abort(); } -/* Generated stub for blinding_next_path_key */ -bool blinding_next_path_key(const struct pubkey *pk UNNEEDED, - const struct sha256 *h UNNEEDED, - struct pubkey *next UNNEEDED) -{ fprintf(stderr, "blinding_next_path_key called!\n"); abort(); } -/* Generated stub for blinding_next_path_privkey */ -bool blinding_next_path_privkey(const struct privkey *e UNNEEDED, - const struct sha256 *h UNNEEDED, - struct privkey *next UNNEEDED) -{ fprintf(stderr, "blinding_next_path_privkey called!\n"); abort(); } -/* Generated stub for fromwire_sciddir_or_pubkey */ -void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - struct sciddir_or_pubkey *sciddpk UNNEEDED) -{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); } -/* Generated stub for towire_sciddir_or_pubkey */ -void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED, - const struct sciddir_or_pubkey *sciddpk UNNEEDED) -{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, char *argv[]) diff --git a/gossipd/test/run-extended-info.c b/gossipd/test/run-extended-info.c index 45e19884d049..417c0eb8b139 100644 --- a/gossipd/test/run-extended-info.c +++ b/gossipd/test/run-extended-info.c @@ -1,6 +1,7 @@ #include "config.h" #include "../queries.c" +#include #include #include #include @@ -16,32 +17,6 @@ #endif /* AUTOGENERATED MOCKS START */ -/* Generated stub for blinding_hash_e_and_ss */ -void blinding_hash_e_and_ss(const struct pubkey *e UNNEEDED, - const struct secret *ss UNNEEDED, - struct sha256 *sha UNNEEDED) -{ fprintf(stderr, "blinding_hash_e_and_ss called!\n"); abort(); } -/* Generated stub for blinding_next_path_key */ -bool blinding_next_path_key(const struct pubkey *pk UNNEEDED, - const struct sha256 *h UNNEEDED, - struct pubkey *next UNNEEDED) -{ fprintf(stderr, "blinding_next_path_key called!\n"); abort(); } -/* Generated stub for blinding_next_path_privkey */ -bool blinding_next_path_privkey(const struct privkey *e UNNEEDED, - const struct sha256 *h UNNEEDED, - struct privkey *next UNNEEDED) -{ fprintf(stderr, "blinding_next_path_privkey called!\n"); abort(); } -/* Generated stub for decode_channel_update_timestamps */ -struct channel_update_timestamps *decode_channel_update_timestamps(const tal_t *ctx UNNEEDED, - const struct tlv_reply_channel_range_tlvs_timestamps_tlv *timestamps_tlv UNNEEDED) -{ fprintf(stderr, "decode_channel_update_timestamps called!\n"); abort(); } -/* Generated stub for decode_short_ids */ -struct short_channel_id *decode_short_ids(const tal_t *ctx UNNEEDED, const u8 *encoded UNNEEDED) -{ fprintf(stderr, "decode_short_ids called!\n"); abort(); } -/* Generated stub for fromwire_sciddir_or_pubkey */ -void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - struct sciddir_or_pubkey *sciddpk UNNEEDED) -{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); } /* Generated stub for peer_supplied_query_response */ void peer_supplied_query_response(struct daemon *daemon UNNEEDED, const struct node_id *source_peer UNNEEDED, @@ -52,15 +27,6 @@ void queue_peer_msg(struct daemon *daemon UNNEEDED, const struct node_id *peer UNNEEDED, const u8 *msg TAKES UNNEEDED) { fprintf(stderr, "queue_peer_msg called!\n"); abort(); } -/* Generated stub for towire_sciddir_or_pubkey */ -void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED, - const struct sciddir_or_pubkey *sciddpk UNNEEDED) -{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); } -/* Generated stub for towire_warningfmt */ -u8 *towire_warningfmt(const tal_t *ctx UNNEEDED, - const struct channel_id *channel UNNEEDED, - const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "towire_warningfmt called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ void status_fmt(enum log_level level UNNEEDED, diff --git a/gossipd/test/run-next_block_range.c b/gossipd/test/run-next_block_range.c index 49bd20f9eea7..60b9530a72d1 100644 --- a/gossipd/test/run-next_block_range.c +++ b/gossipd/test/run-next_block_range.c @@ -12,24 +12,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for blinding_hash_e_and_ss */ -void blinding_hash_e_and_ss(const struct pubkey *e UNNEEDED, - const struct secret *ss UNNEEDED, - struct sha256 *sha UNNEEDED) -{ fprintf(stderr, "blinding_hash_e_and_ss called!\n"); abort(); } -/* Generated stub for blinding_next_path_key */ -bool blinding_next_path_key(const struct pubkey *pk UNNEEDED, - const struct sha256 *h UNNEEDED, - struct pubkey *next UNNEEDED) -{ fprintf(stderr, "blinding_next_path_key called!\n"); abort(); } -/* Generated stub for blinding_next_path_privkey */ -bool blinding_next_path_privkey(const struct privkey *e UNNEEDED, - const struct sha256 *h UNNEEDED, - struct privkey *next UNNEEDED) -{ fprintf(stderr, "blinding_next_path_privkey called!\n"); abort(); } -/* Generated stub for daemon_conn_send */ -void daemon_conn_send(struct daemon_conn *dc UNNEEDED, const u8 *msg UNNEEDED) -{ fprintf(stderr, "daemon_conn_send called!\n"); abort(); } /* Generated stub for find_peer */ struct peer *find_peer(struct daemon *daemon UNNEEDED, const struct node_id *id UNNEEDED) { fprintf(stderr, "find_peer called!\n"); abort(); } @@ -37,83 +19,12 @@ struct peer *find_peer(struct daemon *daemon UNNEEDED, const struct node_id *id struct peer *first_random_peer(struct daemon *daemon UNNEEDED, struct peer_node_id_map_iter *it UNNEEDED) { fprintf(stderr, "first_random_peer called!\n"); abort(); } -/* Generated stub for fromwire_sciddir_or_pubkey */ -void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - struct sciddir_or_pubkey *sciddpk UNNEEDED) -{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); } -/* Generated stub for gossmap_chan_get_update_details */ -void gossmap_chan_get_update_details(const struct gossmap *map UNNEEDED, - const struct gossmap_chan *chan UNNEEDED, - int dir UNNEEDED, - u32 *timestamp UNNEEDED, - u8 *message_flags UNNEEDED, - u8 *channel_flags UNNEEDED, - u16 *cltv_expiry_delta UNNEEDED, - u32 *fee_base_msat UNNEEDED, - u32 *fee_proportional_millionths UNNEEDED, - struct amount_msat *htlc_minimum_msat UNNEEDED, - struct amount_msat *htlc_maximum_msat UNNEEDED) -{ fprintf(stderr, "gossmap_chan_get_update_details called!\n"); abort(); } -/* Generated stub for gossmap_chan_scid */ -struct short_channel_id gossmap_chan_scid(const struct gossmap *map UNNEEDED, - const struct gossmap_chan *c UNNEEDED) -{ fprintf(stderr, "gossmap_chan_scid called!\n"); abort(); } -/* Generated stub for gossmap_find_chan */ -struct gossmap_chan *gossmap_find_chan(const struct gossmap *map UNNEEDED, - const struct short_channel_id *scid UNNEEDED) -{ fprintf(stderr, "gossmap_find_chan called!\n"); abort(); } -/* Generated stub for gossmap_first_node */ -struct gossmap_node *gossmap_first_node(const struct gossmap *map UNNEEDED) -{ fprintf(stderr, "gossmap_first_node called!\n"); abort(); } /* Generated stub for gossmap_manage_get_gossmap */ struct gossmap *gossmap_manage_get_gossmap(struct gossmap_manage *gm UNNEEDED) { fprintf(stderr, "gossmap_manage_get_gossmap called!\n"); abort(); } /* Generated stub for gossmap_manage_populated */ bool gossmap_manage_populated(const struct gossmap_manage *gm UNNEEDED) { fprintf(stderr, "gossmap_manage_populated called!\n"); abort(); } -/* Generated stub for gossmap_max_node_idx */ -u32 gossmap_max_node_idx(const struct gossmap *map UNNEEDED) -{ fprintf(stderr, "gossmap_max_node_idx called!\n"); abort(); } -/* Generated stub for gossmap_next_node */ -struct gossmap_node *gossmap_next_node(const struct gossmap *map UNNEEDED, - const struct gossmap_node *prev UNNEEDED) -{ fprintf(stderr, "gossmap_next_node called!\n"); abort(); } -/* Generated stub for gossmap_node_byidx */ -struct gossmap_node *gossmap_node_byidx(const struct gossmap *map UNNEEDED, u32 idx UNNEEDED) -{ fprintf(stderr, "gossmap_node_byidx called!\n"); abort(); } -/* Generated stub for gossmap_node_get_announce */ -u8 *gossmap_node_get_announce(const tal_t *ctx UNNEEDED, - const struct gossmap *map UNNEEDED, - const struct gossmap_node *n UNNEEDED) -{ fprintf(stderr, "gossmap_node_get_announce called!\n"); abort(); } -/* Generated stub for gossmap_node_get_id */ -void gossmap_node_get_id(const struct gossmap *map UNNEEDED, - const struct gossmap_node *node UNNEEDED, - struct node_id *id UNNEEDED) -{ fprintf(stderr, "gossmap_node_get_id called!\n"); abort(); } -/* Generated stub for gossmap_nth_chan */ -struct gossmap_chan *gossmap_nth_chan(const struct gossmap *map UNNEEDED, - const struct gossmap_node *node UNNEEDED, - u32 n UNNEEDED, - int *which_half UNNEEDED) -{ fprintf(stderr, "gossmap_nth_chan called!\n"); abort(); } -/* Generated stub for gossmap_nth_node */ -struct gossmap_node *gossmap_nth_node(const struct gossmap *map UNNEEDED, - const struct gossmap_chan *chan UNNEEDED, - int n UNNEEDED) -{ fprintf(stderr, "gossmap_nth_node called!\n"); abort(); } -/* Generated stub for gossmap_random_node */ -struct gossmap_node *gossmap_random_node(const struct gossmap *map UNNEEDED) -{ fprintf(stderr, "gossmap_random_node called!\n"); abort(); } -/* Generated stub for memleak_scan_intmap_ */ -void memleak_scan_intmap_(struct htable *memtable UNNEEDED, const struct intmap *m UNNEEDED) -{ fprintf(stderr, "memleak_scan_intmap_ called!\n"); abort(); } -/* Generated stub for new_reltimer_ */ -struct oneshot *new_reltimer_(struct timers *timers UNNEEDED, - const tal_t *ctx UNNEEDED, - struct timerel expire UNNEEDED, - void (*cb)(void *) UNNEEDED, void *arg UNNEEDED) -{ fprintf(stderr, "new_reltimer_ called!\n"); abort(); } /* Generated stub for next_random_peer */ struct peer *next_random_peer(struct daemon *daemon UNNEEDED, const struct peer *first UNNEEDED, @@ -141,23 +52,9 @@ void queue_peer_msg(struct daemon *daemon UNNEEDED, const struct node_id *peer UNNEEDED, const u8 *msg TAKES UNNEEDED) { fprintf(stderr, "queue_peer_msg called!\n"); abort(); } -/* Generated stub for status_failed */ -void status_failed(enum status_failreason code UNNEEDED, - const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "status_failed called!\n"); abort(); } -/* Generated stub for status_fmt */ -void status_fmt(enum log_level level UNNEEDED, - const struct node_id *peer UNNEEDED, - const char *fmt UNNEEDED, ...) - -{ fprintf(stderr, "status_fmt called!\n"); abort(); } /* Generated stub for towire_gossipd_connect_to_peer */ u8 *towire_gossipd_connect_to_peer(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED) { fprintf(stderr, "towire_gossipd_connect_to_peer called!\n"); abort(); } -/* Generated stub for towire_sciddir_or_pubkey */ -void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED, - const struct sciddir_or_pubkey *sciddpk UNNEEDED) -{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ static void test_block_range(struct seeker *seeker, diff --git a/gossipd/test/run-txout_failure.c b/gossipd/test/run-txout_failure.c index ebb740ea77f4..4d3df88e2664 100644 --- a/gossipd/test/run-txout_failure.c +++ b/gossipd/test/run-txout_failure.c @@ -14,29 +14,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for blinding_hash_e_and_ss */ -void blinding_hash_e_and_ss(const struct pubkey *e UNNEEDED, - const struct secret *ss UNNEEDED, - struct sha256 *sha UNNEEDED) -{ fprintf(stderr, "blinding_hash_e_and_ss called!\n"); abort(); } -/* Generated stub for blinding_next_path_key */ -bool blinding_next_path_key(const struct pubkey *pk UNNEEDED, - const struct sha256 *h UNNEEDED, - struct pubkey *next UNNEEDED) -{ fprintf(stderr, "blinding_next_path_key called!\n"); abort(); } -/* Generated stub for blinding_next_path_privkey */ -bool blinding_next_path_privkey(const struct privkey *e UNNEEDED, - const struct sha256 *h UNNEEDED, - struct privkey *next UNNEEDED) -{ fprintf(stderr, "blinding_next_path_privkey called!\n"); abort(); } -/* Generated stub for fromwire_sciddir_or_pubkey */ -void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - struct sciddir_or_pubkey *sciddpk UNNEEDED) -{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); } -/* Generated stub for towire_sciddir_or_pubkey */ -void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED, - const struct sciddir_or_pubkey *sciddpk UNNEEDED) -{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, char *argv[]) diff --git a/hsmd/Makefile b/hsmd/Makefile index b4f51bef2ffd..c60f960eb1d4 100644 --- a/hsmd/Makefile +++ b/hsmd/Makefile @@ -14,48 +14,13 @@ $(HSMD_OBJS): $(HSMD_HEADERS) HSMD_CLIENT_OBJS := \ hsmd/hsmd_wiregen.o \ hsmd/hsm_utxo.o \ - common/htlc_wire.o # Make sure these depend on everything. ALL_C_SOURCES += $(HSMD_SRC) ALL_C_HEADERS += $(HSMD_HEADERS) ALL_PROGRAMS += lightningd/lightning_hsmd -# Common source we use. -HSMD_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/bigsize.o \ - common/bip32.o \ - common/bolt12_id.o \ - common/bolt12_merkle.o \ - common/channel_id.o \ - common/daemon.o \ - common/daemon_conn.o \ - common/derive_basepoints.o \ - common/hash_u5.o \ - common/hsm_encryption.o \ - common/htlc_wire.o \ - common/key_derive.o \ - common/lease_rates.o \ - common/memleak.o \ - common/msg_queue.o \ - common/node_id.o \ - common/onionreply.o \ - common/permute_tx.o \ - common/psbt_open.o \ - common/pseudorand.o \ - common/setup.o \ - common/status.o \ - common/status_wire.o \ - common/status_wiregen.o \ - common/subdaemon.o \ - common/utils.o \ - common/version.o \ - common/wireaddr.o - -lightningd/lightning_hsmd: $(HSMD_OBJS) $(HSMD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) +lightningd/lightning_hsmd: $(HSMD_OBJS) libcommon.a check-source: check-hsm-versions diff --git a/hsmd/hsm_utxo.h b/hsmd/hsm_utxo.h index 62bea00262ec..b7d8d71824fb 100644 --- a/hsmd/hsm_utxo.h +++ b/hsmd/hsm_utxo.h @@ -1,8 +1,6 @@ #ifndef LIGHTNING_HSMD_HSM_UTXO_H #define LIGHTNING_HSMD_HSM_UTXO_H #include "config.h" -#include -#include #include /* FIXME: If we make our static_remotekey a normal keypath key, we can diff --git a/hsmd/hsmd.c b/hsmd/hsmd.c index ff6d1e7b2c91..56f22836e771 100644 --- a/hsmd/hsmd.c +++ b/hsmd/hsmd.c @@ -19,12 +19,12 @@ #include #include #include +#include #include #include /*~ _wiregen files are autogenerated by tools/generate-wire.py */ #include #include -#include #include #include diff --git a/hsmd/hsmd_wire.csv b/hsmd/hsmd_wire.csv index 4a8c7c7d9ec1..4f4a40d1e3fd 100644 --- a/hsmd/hsmd_wire.csv +++ b/hsmd/hsmd_wire.csv @@ -392,6 +392,7 @@ msgdata,hsmd_sign_bolt12,merkleroot,sha256, msgdata,hsmd_sign_bolt12,publictweaklen,u16, msgdata,hsmd_sign_bolt12,publictweak,u8,publictweaklen +#include msgtype,hsmd_sign_bolt12_reply,125 msgdata,hsmd_sign_bolt12_reply,sig,bip340sig, diff --git a/hsmd/libhsmd.c b/hsmd/libhsmd.c index c013ec4aec55..ba52416c033a 100644 --- a/hsmd/libhsmd.c +++ b/hsmd/libhsmd.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/hsmd/libhsmd.h b/hsmd/libhsmd.h index db927284bc3b..652340e212a5 100644 --- a/hsmd/libhsmd.h +++ b/hsmd/libhsmd.h @@ -2,7 +2,6 @@ #define LIGHTNING_HSMD_LIBHSMD_H #include "config.h" -#include #include #include diff --git a/lightningd/Makefile b/lightningd/Makefile index fbf1d10f47a1..4fb5afbc269c 100644 --- a/lightningd/Makefile +++ b/lightningd/Makefile @@ -72,90 +72,6 @@ ALL_PROGRAMS += lightningd/lightningd # We explicitly check header versions in lightningd.c lightningd/lightningd.o: header_versions_gen.h -# Common source we use. -LIGHTNINGD_COMMON_OBJS := \ - common/addr.o \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/base64.o \ - common/bech32.o \ - common/bech32_util.o \ - common/bigsize.o \ - common/bip32.o \ - common/blindedpath.o \ - common/blinding.o \ - common/blockheight_states.o \ - common/bolt11.o \ - common/bolt11_json.o \ - common/bolt12.o \ - common/bolt12_id.o \ - common/bolt12_merkle.o \ - common/codex32.o \ - common/channel_config.o \ - common/channel_id.o \ - common/channel_type.o \ - common/coin_mvt.o \ - common/configdir.o \ - common/configvar.o \ - common/daemon.o \ - common/deprecation.o \ - common/derive_basepoints.o \ - common/ecdh_hsmd.o \ - common/features.o \ - common/fee_states.o \ - common/peer_status_wiregen.o \ - common/scb_wiregen.o \ - common/status_levels.o \ - common/status_wiregen.o \ - common/hash_u5.o \ - common/hmac.o \ - common/hsm_capable.o \ - common/hsm_encryption.o \ - common/htlc_state.o \ - common/htlc_trim.o \ - common/htlc_tx.o \ - common/htlc_wire.o \ - common/key_derive.o \ - common/keyset.o \ - common/json_channel_type.o \ - common/json_command.o \ - common/json_filter.o \ - common/json_param.o \ - common/json_parse.o \ - common/json_parse_simple.o \ - common/json_stream.o \ - common/lease_rates.o \ - common/memleak.o \ - common/msg_queue.o \ - common/node_id.o \ - common/onion_decode.o \ - common/onion_encode.o \ - common/onionreply.o \ - common/penalty_base.o \ - common/per_peer_state.o \ - common/permute_tx.o \ - common/psbt_keypath.o \ - common/psbt_open.o \ - common/pseudorand.o \ - common/plugin.o \ - common/random_select.o \ - common/setup.o \ - common/shutdown_scriptpubkey.o \ - common/sphinx.o \ - common/status_wire.o \ - common/timeout.o \ - common/trace.o \ - common/tx_roles.o \ - common/utils.o \ - common/utxo.o \ - common/version.o \ - common/wallet.o \ - common/wire_error.o \ - common/wireaddr.o \ - db/bindings.o \ - db/exec.o \ - $(LIGHTNINGD_OBJS): $(LIGHTNINGD_HDRS) $(WALLET_OBJS): $(LIGHTNINGD_HDRS) $(DB_HEADERS) @@ -165,6 +81,6 @@ lightningd/plugin.o: plugins/list_of_builtin_plugins_gen.h lightningd/channel_state_names_gen.h: lightningd/channel_state.h ccan/ccan/cdump/tools/cdump-enumstr ccan/ccan/cdump/tools/cdump-enumstr lightningd/channel_state.h > $@ -lightningd/lightningd: $(LIGHTNINGD_OBJS) $(WALLET_OBJS) $(LIGHTNINGD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(WIRE_BOLT12_OBJS) $(LIGHTNINGD_CONTROL_OBJS) $(HSMD_CLIENT_OBJS) $(DB_OBJS) +lightningd/lightningd: $(LIGHTNINGD_OBJS) $(WALLET_OBJS) $(LIGHTNINGD_CONTROL_OBJS) $(HSMD_CLIENT_OBJS) $(DB_OBJS) libcommon.a include lightningd/test/Makefile diff --git a/lightningd/anchorspend.c b/lightningd/anchorspend.c index 2dbe10bb09fe..a194702ec5a1 100644 --- a/lightningd/anchorspend.c +++ b/lightningd/anchorspend.c @@ -1,23 +1,15 @@ #include "config.h" -#include #include -#include #include -#include #include -#include #include -#include #include #include #include #include #include #include -#include #include -#include -#include #include /* This is attached to each anchor tx retransmission */ diff --git a/lightningd/bitcoind.c b/lightningd/bitcoind.c index 771ccf2f9f0a..3e092a5bf6ba 100644 --- a/lightningd/bitcoind.c +++ b/lightningd/bitcoind.c @@ -4,24 +4,15 @@ * standardized and you can use another plugin as the Bitcoin backend, or * even make your own! */ #include "config.h" -#include -#include #include #include -#include #include #include #include -#include -#include -#include #include -#include #include #include #include -#include -#include #include /* The names of the requests we can make to our Bitcoin backend. */ diff --git a/lightningd/bitcoind.h b/lightningd/bitcoind.h index cf92e907513d..3daa5090558c 100644 --- a/lightningd/bitcoind.h +++ b/lightningd/bitcoind.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_LIGHTNINGD_BITCOIND_H #define LIGHTNING_LIGHTNINGD_BITCOIND_H #include "config.h" -#include #include #include #include diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index 59f004f732a7..a35e4d013a7f 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -1,32 +1,23 @@ #include "config.h" -#include #include -#include #include #include #include -#include #include -#include -#include #include #include #include #include -#include #include #include #include +#include #include #include #include -#include -#include -#include #include #include #include -#include /* Mutual recursion via timer. */ static void try_extend_tip(struct chain_topology *topo); diff --git a/lightningd/chaintopology.h b/lightningd/chaintopology.h index 4f80d21622a8..f6aa81887528 100644 --- a/lightningd/chaintopology.h +++ b/lightningd/chaintopology.h @@ -1,9 +1,6 @@ #ifndef LIGHTNING_LIGHTNINGD_CHAINTOPOLOGY_H #define LIGHTNING_LIGHTNINGD_CHAINTOPOLOGY_H #include "config.h" -#include -#include -#include #include struct bitcoin_tx; diff --git a/lightningd/channel.c b/lightningd/channel.c index 354249a4c24c..4db03adada55 100644 --- a/lightningd/channel.c +++ b/lightningd/channel.c @@ -5,20 +5,16 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include -#include #include #include -#include void channel_set_owner(struct channel *channel, struct subd *owner) { diff --git a/lightningd/channel.h b/lightningd/channel.h index af2f18a54b8a..d7f9477536f6 100644 --- a/lightningd/channel.h +++ b/lightningd/channel.h @@ -1,6 +1,7 @@ #ifndef LIGHTNING_LIGHTNINGD_CHANNEL_H #define LIGHTNING_LIGHTNINGD_CHANNEL_H #include "config.h" +#include #include #include #include diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index a72f959837ae..7dcd5e4c4845 100644 --- a/lightningd/channel_control.c +++ b/lightningd/channel_control.c @@ -1,36 +1,26 @@ #include "config.h" #include #include -#include #include #include #include -#include -#include -#include #include #include #include #include #include -#include #include -#include #include #include #include #include -#include #include #include -#include +#include #include #include -#include #include #include -#include -#include struct stfu_result { diff --git a/lightningd/channel_gossip.c b/lightningd/channel_gossip.c index d4153b207ad4..79b12ffc5f02 100644 --- a/lightningd/channel_gossip.c +++ b/lightningd/channel_gossip.c @@ -1,7 +1,6 @@ #include "config.h" #include #include -#include #include #include #include @@ -13,7 +12,6 @@ #include #include #include -#include #include enum channel_gossip_state { diff --git a/lightningd/channel_state.h b/lightningd/channel_state.h index 26d12d81d6df..9db105fb1fad 100644 --- a/lightningd/channel_state.h +++ b/lightningd/channel_state.h @@ -2,7 +2,6 @@ #define LIGHTNING_LIGHTNINGD_CHANNEL_STATE_H #include "config.h" -#include /* These are in the database, so don't renumber them! */ enum channel_state { diff --git a/lightningd/closed_channel.c b/lightningd/closed_channel.c index dd85f4fc2542..73b572feb35f 100644 --- a/lightningd/closed_channel.c +++ b/lightningd/closed_channel.c @@ -1,14 +1,9 @@ #include "config.h" #include -#include -#include -#include #include #include #include #include -#include -#include size_t hash_cid(const struct channel_id *cid) { diff --git a/lightningd/closing_control.c b/lightningd/closing_control.c index 36fe90f696bb..c3f2d7b8d070 100644 --- a/lightningd/closing_control.c +++ b/lightningd/closing_control.c @@ -1,43 +1,27 @@ #include "config.h" -#include #include -#include -#include #include #include #include -#include #include -#include -#include -#include #include -#include #include #include -#include -#include #include -#include #include #include -#include #include #include #include #include #include +#include #include #include #include -#include #include -#include -#include #include -#include #include -#include struct close_command { /* Inside struct lightningd close_commands. */ diff --git a/lightningd/coin_mvts.c b/lightningd/coin_mvts.c index cc206b62b1bb..dcbc30594f89 100644 --- a/lightningd/coin_mvts.c +++ b/lightningd/coin_mvts.c @@ -1,11 +1,9 @@ #include "config.h" -#include #include #include #include #include #include -#include struct channel_coin_mvt *new_channel_mvt_invoice_hin(const tal_t *ctx, diff --git a/lightningd/configs.c b/lightningd/configs.c index 0585717768c7..31c2b869348d 100644 --- a/lightningd/configs.c +++ b/lightningd/configs.c @@ -10,14 +10,9 @@ #include #include #include -#include -#include #include #include -#include -#include #include -#include static void json_add_source(struct json_stream *result, const char *fieldname, diff --git a/lightningd/connect_control.c b/lightningd/connect_control.c index 2cdeb610ba48..d4268115506b 100644 --- a/lightningd/connect_control.c +++ b/lightningd/connect_control.c @@ -1,26 +1,17 @@ #include "config.h" -#include #include +#include #include -#include #include -#include -#include -#include #include -#include #include #include -#include #include #include #include -#include #include #include #include -#include -#include #include #include diff --git a/lightningd/datastore.c b/lightningd/datastore.c index f3ecfc6d9167..8ccb53382e3b 100644 --- a/lightningd/datastore.c +++ b/lightningd/datastore.c @@ -1,8 +1,6 @@ #include "config.h" #include #include -#include -#include #include #include diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 1e46c06a991c..03ba0eca925b 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -3,7 +3,6 @@ * saves and funding tx watching for a channel open */ #include "config.h" -#include #include #include #include @@ -11,25 +10,22 @@ #include #include #include -#include #include #include #include #include #include #include -#include #include #include #include #include #include #include -#include +#include #include #include #include -#include #include #include #include diff --git a/lightningd/feerate.c b/lightningd/feerate.c index 56b0e8229f8b..78027a56a4c2 100644 --- a/lightningd/feerate.c +++ b/lightningd/feerate.c @@ -1,5 +1,4 @@ #include "config.h" -#include #include #include #include diff --git a/lightningd/forwards.c b/lightningd/forwards.c index ecb14094c58e..6c86d5063614 100644 --- a/lightningd/forwards.c +++ b/lightningd/forwards.c @@ -2,14 +2,10 @@ #include #include #include -#include -#include #include #include -#include #include #include -#include static u64 forward_index_inc(struct lightningd *ld, enum forward_status status, diff --git a/lightningd/forwards.h b/lightningd/forwards.h index f65dd1687392..0436035b1e76 100644 --- a/lightningd/forwards.h +++ b/lightningd/forwards.h @@ -2,7 +2,8 @@ #ifndef LIGHTNING_LIGHTNINGD_FORWARDS_H #define LIGHTNING_LIGHTNINGD_FORWARDS_H #include "config.h" -#include +#include +#include struct json_stream; struct lightningd; diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 4e931a7844cf..6b484a77eba5 100644 --- a/lightningd/gossip_control.c +++ b/lightningd/gossip_control.c @@ -1,28 +1,17 @@ #include "config.h" #include -#include +#include #include -#include -#include #include -#include -#include -#include -#include #include -#include -#include #include -#include #include #include -#include #include #include #include #include #include -#include #include static void got_txout(struct bitcoind *bitcoind, diff --git a/lightningd/gossip_control.h b/lightningd/gossip_control.h index 06a248799dfd..49baa7fffbe6 100644 --- a/lightningd/gossip_control.h +++ b/lightningd/gossip_control.h @@ -2,8 +2,6 @@ #define LIGHTNING_LIGHTNINGD_GOSSIP_CONTROL_H #include "config.h" #include -#include -#include struct channel; struct lightningd; diff --git a/lightningd/gossip_generation.c b/lightningd/gossip_generation.c index 22877c9c0596..7a59f0e9d213 100644 --- a/lightningd/gossip_generation.c +++ b/lightningd/gossip_generation.c @@ -1,14 +1,9 @@ #include "config.h" #include #include -#include -#include -#include #include #include #include -#include -#include /* Once we know which way nodes go, it's easy to construct */ static u8 *create_channel_announcement_dir(const tal_t *ctx, diff --git a/lightningd/hsm_control.c b/lightningd/hsm_control.c index 7c0c6587fdc0..599ef4081222 100644 --- a/lightningd/hsm_control.c +++ b/lightningd/hsm_control.c @@ -2,22 +2,17 @@ #include #include #include -#include #include #include #include #include #include -#include -#include #include #include #include #include #include #include -#include -#include #include #include diff --git a/lightningd/htlc_end.c b/lightningd/htlc_end.c index 91d66b0c3357..e2a06170dd4f 100644 --- a/lightningd/htlc_end.c +++ b/lightningd/htlc_end.c @@ -1,13 +1,10 @@ #include "config.h" #include -#include #include -#include #include -#include +#include #include #include -#include size_t hash_htlc_key(const struct htlc_key *k) { diff --git a/lightningd/htlc_set.c b/lightningd/htlc_set.c index 47677678d28a..5d2531fff060 100644 --- a/lightningd/htlc_set.c +++ b/lightningd/htlc_set.c @@ -1,5 +1,4 @@ #include "config.h" -#include #include #include #include diff --git a/lightningd/htlc_set.h b/lightningd/htlc_set.h index c93ca1536151..bb0119dc3ca8 100644 --- a/lightningd/htlc_set.h +++ b/lightningd/htlc_set.h @@ -7,7 +7,6 @@ #include #include #include -#include struct lightningd; struct logger; diff --git a/lightningd/invoice.c b/lightningd/invoice.c index 31362ab6c7ef..dfdf633e45b2 100644 --- a/lightningd/invoice.c +++ b/lightningd/invoice.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include @@ -10,14 +9,9 @@ #include #include #include -#include #include -#include -#include #include #include -#include -#include #include #include #include @@ -27,10 +21,8 @@ #include #include #include -#include #include #include -#include const char *invoice_status_str(enum invoice_status state) { diff --git a/lightningd/invoice.h b/lightningd/invoice.h index 90c31cb27161..43e98b2a13b8 100644 --- a/lightningd/invoice.h +++ b/lightningd/invoice.h @@ -2,7 +2,6 @@ #define LIGHTNING_LIGHTNINGD_INVOICE_H #include "config.h" #include -#include struct amount_msat; struct htlc_set; diff --git a/lightningd/jsonrpc.c b/lightningd/jsonrpc.c index 7370ad73ac5b..95d32cb11784 100644 --- a/lightningd/jsonrpc.c +++ b/lightningd/jsonrpc.c @@ -23,11 +23,8 @@ #include #include #include -#include -#include #include #include -#include #include #include #include @@ -36,11 +33,7 @@ #include #include #include -#include #include -#include -#include -#include /* Dummy structure. */ diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 5a350daeb43e..8eb3acc9cac5 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -37,8 +37,8 @@ */ #include #include +#include #include -#include #include #include #include @@ -47,12 +47,11 @@ /*~ This is common code: routines shared by one or more executables * (separate daemons, or the lightning-cli program). */ -#include #include #include #include +#include #include -#include #include #include #include @@ -62,13 +61,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include @@ -76,7 +73,6 @@ #include #include #include -#include #include #include #include diff --git a/lightningd/log.c b/lightningd/log.c index 9775e79f44b1..5b5bcd5ae272 100644 --- a/lightningd/log.c +++ b/lightningd/log.c @@ -7,13 +7,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include /* What logging level to use if they didn't specify */ diff --git a/lightningd/memdump.c b/lightningd/memdump.c index b2f32a10636f..2372ab0a9a3f 100644 --- a/lightningd/memdump.c +++ b/lightningd/memdump.c @@ -3,12 +3,9 @@ #include #include #include -#include #include #include #include -#include -#include #include #include #include @@ -17,8 +14,6 @@ #include #include #include -#include -#include #include static void json_add_ptr(struct json_stream *response, const char *name, diff --git a/lightningd/notification.c b/lightningd/notification.c index 75134ecdea91..73a689b977f4 100644 --- a/lightningd/notification.c +++ b/lightningd/notification.c @@ -1,9 +1,7 @@ #include "config.h" #include -#include #include #include -#include #include bool notifications_topic_is_native(const char *topic) diff --git a/lightningd/offer.c b/lightningd/offer.c index 9b26d75ad08f..dd8871cbe474 100644 --- a/lightningd/offer.c +++ b/lightningd/offer.c @@ -1,20 +1,13 @@ #include "config.h" #include -#include -#include #include #include -#include #include -#include -#include -#include #include #include #include #include #include -#include static void json_populate_offer(struct json_stream *response, const struct sha256 *offer_id, diff --git a/lightningd/onchain_control.c b/lightningd/onchain_control.c index b82523ab1b38..09d5d89666e1 100644 --- a/lightningd/onchain_control.c +++ b/lightningd/onchain_control.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -18,15 +17,10 @@ #include #include #include -#include #include #include #include #include -#include -#include -#include -#include /* If we're restarting, we keep a per-channel copy of watches, and replay */ struct replay_tx { diff --git a/lightningd/onion_message.c b/lightningd/onion_message.c index 6c0949813131..70efb66e53d1 100644 --- a/lightningd/onion_message.c +++ b/lightningd/onion_message.c @@ -1,18 +1,12 @@ #include "config.h" -#include #include #include -#include #include #include -#include #include -#include #include -#include #include #include -#include struct onion_message_hook_payload { /* Optional */ diff --git a/lightningd/opening_common.c b/lightningd/opening_common.c index 79f7867c5733..5b03d2a71c4a 100644 --- a/lightningd/opening_common.c +++ b/lightningd/opening_common.c @@ -1,19 +1,12 @@ #include "config.h" #include #include -#include -#include #include #include -#include -#include #include #include #include -#include -#include #include -#include static void destroy_uncommitted_channel(struct uncommitted_channel *uc) { diff --git a/lightningd/opening_common.h b/lightningd/opening_common.h index 8b75b56a022f..21ca82286bf9 100644 --- a/lightningd/opening_common.h +++ b/lightningd/opening_common.h @@ -1,8 +1,6 @@ #ifndef LIGHTNING_LIGHTNINGD_OPENING_COMMON_H #define LIGHTNING_LIGHTNINGD_OPENING_COMMON_H #include "config.h" -#include -#include #include #include #include diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c index 7c12a0ffd551..12e0ea048742 100644 --- a/lightningd/opening_control.c +++ b/lightningd/opening_control.c @@ -1,25 +1,21 @@ #include "config.h" -#include #include #include #include #include #include #include -#include #include #include #include -#include #include -#include #include #include #include -#include #include #include #include +#include #include #include #include diff --git a/lightningd/options.c b/lightningd/options.c index e565c62f9452..ca54f38b9fb6 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -2,35 +2,27 @@ #include #include #include -#include -#include #include #include -#include #include #include -#include #include #include #include #include #include -#include +#include #include -#include -#include #include -#include #include #include #include #include #include -#include +#include #include #include #include -#include #include /* FIXME: Put into ccan/time. */ diff --git a/lightningd/pay.c b/lightningd/pay.c index 44931d700ea3..0cca0b860ff3 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -4,19 +4,15 @@ #include #include #include -#include #include -#include #include #include #include #include -#include #include #include #include #include -#include #include #include diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 19780fae7e7a..95764921870d 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1,46 +1,22 @@ #include "config.h" -#include #include #include -#include #include #include -#include -#include -#include -#include -#include -#include #include #include #include -#include -#include -#include -#include #include #include #include #include -#include -#include -#include -#include -#include -#include #include -#include #include #include #include #include -#include -#include #include -#include #include -#include -#include #include #include #include @@ -48,31 +24,19 @@ #include #include #include -#include #include -#include -#include -#include #include #include #include #include #include -#include #include #include #include #include -#include -#include #include #include #include -#include -#include -#include -#include -#include /* FIXME: Reorder! */ static void peer_disconnected(struct lightningd *ld, diff --git a/lightningd/peer_fd.h b/lightningd/peer_fd.h index a6e1f011fd31..89041260ec43 100644 --- a/lightningd/peer_fd.h +++ b/lightningd/peer_fd.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_LIGHTNINGD_PEER_FD_H #define LIGHTNING_LIGHTNINGD_PEER_FD_H #include "config.h" -#include #include /* Tal wrapper for fd connecting subd to connectd */ diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 27c3a4757674..66229340ce29 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -3,32 +3,20 @@ #include #include #include -#include #include -#include #include #include -#include #include #include #include -#include #include -#include -#include #include #include #include -#include -#include #include #include #include #include -#include -#include -#include -#include #ifndef SUPERVERBOSE #define SUPERVERBOSE(...) diff --git a/lightningd/ping.c b/lightningd/ping.c index 45ceb3323fe4..b348eec53068 100644 --- a/lightningd/ping.c +++ b/lightningd/ping.c @@ -1,12 +1,9 @@ #include "config.h" #include -#include #include #include -#include #include #include -#include #include #include diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 5d031e73af9a..b9f5e5a9b2d5 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -5,17 +5,13 @@ #include #include #include -#include -#include #include #include #include #include #include -#include #include #include -#include #include #include #include @@ -32,7 +28,6 @@ #include #include #include -#include /* Only this file can include this generated header! */ # include diff --git a/lightningd/plugin_control.c b/lightningd/plugin_control.c index 2f8bb4ed0596..51d230efd46e 100644 --- a/lightningd/plugin_control.c +++ b/lightningd/plugin_control.c @@ -2,13 +2,11 @@ #include #include #include -#include #include #include #include #include #include -#include /* A dummy structure used to give multiple arguments to callbacks. */ struct plugin_command { diff --git a/lightningd/plugin_hook.c b/lightningd/plugin_hook.c index cd69b794da83..934fa16355e1 100644 --- a/lightningd/plugin_hook.c +++ b/lightningd/plugin_hook.c @@ -1,7 +1,5 @@ #include "config.h" #include -#include -#include #include #include #include diff --git a/lightningd/routehint.c b/lightningd/routehint.c index 5c0d80a432d4..27264f65e145 100644 --- a/lightningd/routehint.c +++ b/lightningd/routehint.c @@ -1,10 +1,6 @@ #include "config.h" -#include -#include -#include #include #include -#include #include static bool scid_in_arr(const struct short_channel_id *scidarr, diff --git a/lightningd/runes.c b/lightningd/runes.c index 77be7a30a0ad..70821bcb9c0b 100644 --- a/lightningd/runes.c +++ b/lightningd/runes.c @@ -2,23 +2,16 @@ #include #include #include -#include #include #include -#include #include -#include -#include -#include #include -#include -#include #include +#include #include #include #include #include -#include /* "640k should be enough for anybody!" */ #define MAX_BLACKLIST_NUM 100000000 diff --git a/lightningd/signmessage.c b/lightningd/signmessage.c index 7ecc8423edde..b13e4f86a643 100644 --- a/lightningd/signmessage.c +++ b/lightningd/signmessage.c @@ -1,9 +1,6 @@ #include "config.h" #include -#include #include -#include -#include #include #include #include diff --git a/lightningd/subd.c b/lightningd/subd.c index 263ce03c6b23..6eb0387b6625 100644 --- a/lightningd/subd.c +++ b/lightningd/subd.c @@ -1,5 +1,4 @@ #include "config.h" -#include #include #include #include @@ -7,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -17,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/lightningd/subd.h b/lightningd/subd.h index c572a77d05b8..8518b065590a 100644 --- a/lightningd/subd.h +++ b/lightningd/subd.h @@ -1,12 +1,7 @@ #ifndef LIGHTNING_LIGHTNINGD_SUBD_H #define LIGHTNING_LIGHTNINGD_SUBD_H #include "config.h" -#include #include -#include -#include -#include -#include #include struct crypto_state; diff --git a/lightningd/test/Makefile b/lightningd/test/Makefile index a9aa3c12852b..ade3d8cf7151 100644 --- a/lightningd/test/Makefile +++ b/lightningd/test/Makefile @@ -10,29 +10,8 @@ ALL_TEST_PROGRAMS += $(LIGHTNINGD_TEST_PROGRAMS) # run-find_my_abspath.c includes lightningd.c, which includes header_versions_gen.h lightningd/test/run-find_my_abspath.o: header_versions_gen.h -LIGHTNINGD_TEST_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/bech32.o \ - common/daemon_conn.o \ - common/htlc_state.o \ - common/htlc_wire.o \ - common/json_parse_simple.o \ - common/key_derive.o \ - common/pseudorand.o \ - common/random_select.o \ - common/memleak.o \ - common/msg_queue.o \ - common/onionreply.o \ - common/setup.o \ - common/utils.o \ - common/utxo.o \ - common/permute_tx.o \ - common/wireaddr.o \ +$(LIGHTNINGD_TEST_PROGRAMS): libcommon.a -$(LIGHTNINGD_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(LIGHTNINGD_TEST_COMMON_OBJS) $(WIRE_BOLT12_OBJS) - -$(LIGHTNINGD_TEST_OBJS): $(LIGHTNINGD_HDRS) $(LIGHTNINGD_SRC) $(LIGHTNINGD_SRC_NOHDR) +$(LIGHTNINGD_TEST_OBJS): $(LIGHTNINGD_HDRS) $(LIGHTNINGD_SRC) $(LIGHTNINGD_SRC_NOHDR) lightningd/test/Makefile check-units: $(LIGHTNINGD_TEST_PROGRAMS:%=unittest/%) diff --git a/lightningd/test/run-check_node_announcement.c b/lightningd/test/run-check_node_announcement.c index c41bc1b76cdf..01155a6f2b5e 100644 --- a/lightningd/test/run-check_node_announcement.c +++ b/lightningd/test/run-check_node_announcement.c @@ -10,44 +10,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for check_signed_hash_nodeid */ -bool check_signed_hash_nodeid(const struct sha256_double *hash UNNEEDED, - const secp256k1_ecdsa_signature *signature UNNEEDED, - const struct node_id *id UNNEEDED) -{ fprintf(stderr, "check_signed_hash_nodeid 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(); } -/* Generated stub for fromwire_channel_id */ -bool 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_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 get_agreed_channelfeatures */ -u8 *get_agreed_channelfeatures(const tal_t *ctx UNNEEDED, - const struct feature_set *our_features UNNEEDED, - const u8 *theirfeatures UNNEEDED) -{ fprintf(stderr, "get_agreed_channelfeatures called!\n"); abort(); } -/* Generated stub for node_id_cmp */ -int node_id_cmp(const struct node_id *a UNNEEDED, const struct node_id *b UNNEEDED) -{ fprintf(stderr, "node_id_cmp called!\n"); abort(); } -/* Generated stub for pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace 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_node_id */ -void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "towire_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, char *argv[]) diff --git a/lightningd/test/run-find_my_abspath.c b/lightningd/test/run-find_my_abspath.c index 4c86ad9ac879..7f15dc1b8e76 100644 --- a/lightningd/test/run-find_my_abspath.c +++ b/lightningd/test/run-find_my_abspath.c @@ -4,7 +4,9 @@ int unused_main(int argc, char *argv[]); #include "../io_loop_with_timers.c" #include "../lightningd.c" #include "../subd.c" +#include #include +#include /* AUTOGENERATED MOCKS START */ /* Generated stub for begin_topology */ @@ -16,6 +18,25 @@ void channel_gossip_notify_new_block(struct lightningd *ld UNNEEDED) /* Generated stub for channel_notify_new_block */ void channel_notify_new_block(struct lightningd *ld UNNEEDED) { fprintf(stderr, "channel_notify_new_block called!\n"); abort(); } +/* Generated stub for command_check_only */ +bool command_check_only(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_check_only called!\n"); abort(); } +/* Generated stub for command_dev_apis */ +bool command_dev_apis(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_dev_apis called!\n"); abort(); } +/* Generated stub for command_fail */ +struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_fail called!\n"); abort(); } +/* Generated stub for command_filter_ptr */ +struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_filter_ptr called!\n"); abort(); } +/* Generated stub for command_log */ +void command_log(struct command *cmd UNNEEDED, enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_log called!\n"); abort(); } /* Generated stub for connectd_activate */ void connectd_activate(struct lightningd *ld UNNEEDED) { fprintf(stderr, "connectd_activate called!\n"); abort(); } @@ -25,20 +46,6 @@ int connectd_init(struct lightningd *ld UNNEEDED) /* Generated stub for connectd_start_shutdown */ void connectd_start_shutdown(struct subd *connectd UNNEEDED) { fprintf(stderr, "connectd_start_shutdown called!\n"); abort(); } -/* Generated stub for daemon_developer_mode */ -bool daemon_developer_mode(char *argv[]) -{ fprintf(stderr, "daemon_developer_mode called!\n"); abort(); } -/* Generated stub for daemon_poll */ -int daemon_poll(struct pollfd *fds UNNEEDED, nfds_t nfds UNNEEDED, int timeout UNNEEDED) -{ fprintf(stderr, "daemon_poll called!\n"); abort(); } -/* Generated stub for daemon_setup */ -void daemon_setup(const char *argv0 UNNEEDED, - void (*backtrace_print)(const char *fmt UNNEEDED, ...) UNNEEDED, - void (*backtrace_exit)(void)) -{ fprintf(stderr, "daemon_setup called!\n"); abort(); } -/* Generated stub for daemon_shutdown */ -void daemon_shutdown(void) -{ fprintf(stderr, "daemon_shutdown called!\n"); abort(); } /* Generated stub for db_begin_transaction_ */ void db_begin_transaction_(struct db *db UNNEEDED, const char *location UNNEEDED) { fprintf(stderr, "db_begin_transaction_ called!\n"); abort(); } @@ -51,61 +58,15 @@ s64 db_get_intvar(struct db *db UNNEEDED, const char *varname UNNEEDED, s64 defv /* Generated stub for db_in_transaction */ bool db_in_transaction(struct db *db UNNEEDED) { fprintf(stderr, "db_in_transaction called!\n"); abort(); } -/* Generated stub for deprecated_ok_ */ -bool deprecated_ok_(bool deprecated_apis UNNEEDED, - const char *feature UNNEEDED, - const char *start UNNEEDED, - const char *end UNNEEDED, - const char **begs UNNEEDED, - void (*complain)(const char *feat UNNEEDED, bool allowing UNNEEDED, void *) UNNEEDED, - void *cbarg UNNEEDED) -{ fprintf(stderr, "deprecated_ok_ called!\n"); abort(); } -/* Generated stub for discard_key */ -void discard_key(struct secret *key TAKES UNNEEDED) -{ fprintf(stderr, "discard_key called!\n"); abort(); } -/* Generated stub for ecdh_hsmd_setup */ -void ecdh_hsmd_setup(int hsm_fd UNNEEDED, - void (*failed)(enum status_failreason UNNEEDED, - const char *fmt UNNEEDED, ...)) -{ fprintf(stderr, "ecdh_hsmd_setup called!\n"); abort(); } /* Generated stub for fatal */ void fatal(const char *fmt UNNEEDED, ...) { fprintf(stderr, "fatal called!\n"); abort(); } -/* Generated stub for feature_set_for_feature */ -struct feature_set *feature_set_for_feature(const tal_t *ctx UNNEEDED, int feature UNNEEDED) -{ fprintf(stderr, "feature_set_for_feature called!\n"); abort(); } -/* Generated stub for feature_set_or */ -bool feature_set_or(struct feature_set *a UNNEEDED, - const struct feature_set *b TAKES UNNEEDED) -{ fprintf(stderr, "feature_set_or called!\n"); abort(); } -/* Generated stub for fmt_node_id */ -char *fmt_node_id(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "fmt_node_id called!\n"); abort(); } /* Generated stub for free_htlcs */ void free_htlcs(struct lightningd *ld UNNEEDED, const struct channel *channel UNNEEDED) { fprintf(stderr, "free_htlcs 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(); } -/* Generated stub for fromwire_channel_id */ -bool 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_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 fromwire_status_fail */ -bool fromwire_status_fail(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, enum status_failreason *failreason UNNEEDED, wirestring **desc UNNEEDED) -{ fprintf(stderr, "fromwire_status_fail called!\n"); abort(); } -/* Generated stub for fromwire_status_peer_billboard */ -bool fromwire_status_peer_billboard(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, bool *perm UNNEEDED, wirestring **happenings UNNEEDED) -{ fprintf(stderr, "fromwire_status_peer_billboard called!\n"); abort(); } -/* Generated stub for fromwire_status_peer_error */ -bool fromwire_status_peer_error(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, bool *disconnect UNNEEDED, wirestring **desc UNNEEDED, bool *warning UNNEEDED, u8 **error_for_them UNNEEDED) -{ fprintf(stderr, "fromwire_status_peer_error called!\n"); abort(); } -/* Generated stub for fromwire_status_version */ -bool fromwire_status_version(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, wirestring **version UNNEEDED) -{ fprintf(stderr, "fromwire_status_version called!\n"); abort(); } +/* Generated stub for fromwire_hsmd_ecdh_resp */ +bool fromwire_hsmd_ecdh_resp(const void *p UNNEEDED, struct secret *ss UNNEEDED) +{ fprintf(stderr, "fromwire_hsmd_ecdh_resp called!\n"); abort(); } /* Generated stub for gossip_init */ void gossip_init(struct lightningd *ld UNNEEDED, int connectd_fd UNNEEDED) { fprintf(stderr, "gossip_init called!\n"); abort(); } @@ -137,11 +98,6 @@ void htlcs_resubmit(struct lightningd *ld UNNEEDED, /* Generated stub for invoices_start_expiration */ void invoices_start_expiration(struct lightningd *ld UNNEEDED) { fprintf(stderr, "invoices_start_expiration called!\n"); abort(); } -/* Generated stub for json_add_string */ -void json_add_string(struct json_stream *js UNNEEDED, - const char *fieldname UNNEEDED, - const char *str TAKES UNNEEDED) -{ fprintf(stderr, "json_add_string called!\n"); abort(); } /* Generated stub for jsonrpc_listen */ void jsonrpc_listen(struct jsonrpc *rpc UNNEEDED, struct lightningd *ld UNNEEDED) { fprintf(stderr, "jsonrpc_listen called!\n"); abort(); } @@ -222,9 +178,6 @@ struct plugins *plugins_new(const tal_t *ctx UNNEEDED, struct log_book *log_book void plugins_set_builtin_plugins_dir(struct plugins *plugins UNNEEDED, const char *dir UNNEEDED) { fprintf(stderr, "plugins_set_builtin_plugins_dir called!\n"); abort(); } -/* Generated stub for pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } /* Generated stub for resend_closing_transactions */ void resend_closing_transactions(struct lightningd *ld UNNEEDED) { fprintf(stderr, "resend_closing_transactions called!\n"); abort(); } @@ -234,9 +187,6 @@ struct runes *runes_early_init(struct lightningd *ld UNNEEDED) /* Generated stub for runes_finish_init */ void runes_finish_init(struct runes *runes UNNEEDED) { fprintf(stderr, "runes_finish_init called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace called!\n"); abort(); } /* Generated stub for setup_color_and_alias */ void setup_color_and_alias(struct lightningd *ld UNNEEDED) { fprintf(stderr, "setup_color_and_alias called!\n"); abort(); } @@ -252,24 +202,9 @@ void shutdown_plugins(struct lightningd *ld UNNEEDED) /* Generated stub for stop_topology */ void stop_topology(struct chain_topology *topo UNNEEDED) { fprintf(stderr, "stop_topology called!\n"); abort(); } -/* Generated stub for timer_expired */ -void timer_expired(struct timer *timer UNNEEDED) -{ fprintf(stderr, "timer_expired 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_node_id */ -void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "towire_node_id called!\n"); abort(); } -/* Generated stub for trace_span_end */ -void trace_span_end(const void *key UNNEEDED) -{ fprintf(stderr, "trace_span_end called!\n"); abort(); } -/* Generated stub for trace_span_start_ */ -void trace_span_start_(const char *name UNNEEDED, const void *key UNNEEDED) -{ fprintf(stderr, "trace_span_start_ called!\n"); abort(); } +/* Generated stub for towire_hsmd_ecdh_req */ +u8 *towire_hsmd_ecdh_req(const tal_t *ctx UNNEEDED, const struct pubkey *point UNNEEDED) +{ fprintf(stderr, "towire_hsmd_ecdh_req called!\n"); abort(); } /* Generated stub for txfilter_add_derkey */ void txfilter_add_derkey(struct txfilter *filter UNNEEDED, const u8 derkey[PUBKEY_CMPR_LEN]) @@ -277,9 +212,6 @@ void txfilter_add_derkey(struct txfilter *filter UNNEEDED, /* Generated stub for txfilter_new */ struct txfilter *txfilter_new(const tal_t *ctx UNNEEDED) { fprintf(stderr, "txfilter_new called!\n"); abort(); } -/* Generated stub for version */ -const char *version(void) -{ fprintf(stderr, "version called!\n"); abort(); } /* Generated stub for waitblockheight_notify_new_block */ void waitblockheight_notify_new_block(struct lightningd *ld UNNEEDED) { fprintf(stderr, "waitblockheight_notify_new_block called!\n"); abort(); } diff --git a/lightningd/test/run-invoice-select-inchan.c b/lightningd/test/run-invoice-select-inchan.c index 00eef5e44b70..91b074482bfe 100644 --- a/lightningd/test/run-invoice-select-inchan.c +++ b/lightningd/test/run-invoice-select-inchan.c @@ -26,42 +26,6 @@ void bitcoind_getutxout_(const tal_t *ctx UNNEEDED, void *) UNNEEDED, void *arg UNNEEDED) { fprintf(stderr, "bitcoind_getutxout_ called!\n"); abort(); } -/* Generated stub for bolt11_decode */ -struct bolt11 *bolt11_decode(const tal_t *ctx UNNEEDED, const char *str UNNEEDED, - const struct feature_set *our_features UNNEEDED, - const char *description UNNEEDED, - const struct chainparams *must_be_chain UNNEEDED, - char **fail UNNEEDED) -{ fprintf(stderr, "bolt11_decode called!\n"); abort(); } -/* Generated stub for bolt11_decode_nosig */ -struct bolt11 *bolt11_decode_nosig(const tal_t *ctx UNNEEDED, const char *str UNNEEDED, - const struct feature_set *our_features UNNEEDED, - const char *description UNNEEDED, - const struct chainparams *must_be_chain UNNEEDED, - struct sha256 *hash UNNEEDED, - const u5 **sig UNNEEDED, - bool *have_n UNNEEDED, - char **fail UNNEEDED) -{ fprintf(stderr, "bolt11_decode_nosig called!\n"); abort(); } -/* Generated stub for bolt11_encode_ */ -char *bolt11_encode_(const tal_t *ctx UNNEEDED, - const struct bolt11 *b11 UNNEEDED, bool n_field UNNEEDED, - bool (*sign)(const u5 *u5bytes UNNEEDED, - const u8 *hrpu8 UNNEEDED, - secp256k1_ecdsa_recoverable_signature *rsig UNNEEDED, - void *arg) UNNEEDED, - void *arg UNNEEDED) -{ fprintf(stderr, "bolt11_encode_ called!\n"); abort(); } -/* Generated stub for bolt12_path_id */ -u8 *bolt12_path_id(const tal_t *ctx UNNEEDED, - const struct secret *base_secret UNNEEDED, - const struct sha256 *payment_hash UNNEEDED) -{ fprintf(stderr, "bolt12_path_id called!\n"); abort(); } -/* Generated stub for bolt12_path_secret */ -void bolt12_path_secret(const struct secret *base_secret UNNEEDED, - const struct sha256 *payment_hash UNNEEDED, - struct secret *path_secret UNNEEDED) -{ fprintf(stderr, "bolt12_path_secret called!\n"); abort(); } /* Generated stub for broadcast_tx_ */ void broadcast_tx_(const tal_t *ctx UNNEEDED, struct chain_topology *topo UNNEEDED, @@ -144,9 +108,6 @@ const char *channel_state_name(const struct channel *channel UNNEEDED) /* Generated stub for channel_state_str */ const char *channel_state_str(enum channel_state state UNNEEDED) { fprintf(stderr, "channel_state_str called!\n"); abort(); } -/* Generated stub for channel_type_has */ -bool channel_type_has(const struct channel_type *type UNNEEDED, int feature UNNEEDED) -{ fprintf(stderr, "channel_type_has called!\n"); abort(); } /* Generated stub for channel_unsaved_close_conn */ void channel_unsaved_close_conn(struct channel *channel UNNEEDED, const char *why UNNEEDED) { fprintf(stderr, "channel_unsaved_close_conn called!\n"); abort(); } @@ -174,32 +135,42 @@ struct command_result *command_check_done(struct command *cmd) /* Generated stub for command_check_only */ bool command_check_only(const struct command *cmd UNNEEDED) { fprintf(stderr, "command_check_only called!\n"); abort(); } +/* Generated stub for command_deprecated_in_ok */ +bool command_deprecated_in_ok(struct command *cmd UNNEEDED, + const char *param UNNEEDED, + const char *depr_start UNNEEDED, + const char *depr_end UNNEEDED) +{ fprintf(stderr, "command_deprecated_in_ok called!\n"); abort(); } /* Generated stub for command_deprecated_out_ok */ bool command_deprecated_out_ok(struct command *cmd UNNEEDED, const char *fieldname UNNEEDED, const char *depr_start UNNEEDED, const char *depr_end UNNEEDED) { fprintf(stderr, "command_deprecated_out_ok called!\n"); abort(); } +/* Generated stub for command_dev_apis */ +bool command_dev_apis(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_dev_apis called!\n"); abort(); } /* Generated stub for command_fail */ struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "command_fail called!\n"); abort(); } -/* Generated stub for command_fail_badparam */ -struct command_result *command_fail_badparam(struct command *cmd UNNEEDED, - const char *paramname UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - const char *msg UNNEEDED) -{ fprintf(stderr, "command_fail_badparam called!\n"); abort(); } /* Generated stub for command_failed */ struct command_result *command_failed(struct command *cmd UNNEEDED, struct json_stream *result) { fprintf(stderr, "command_failed called!\n"); abort(); } +/* Generated stub for command_filter_ptr */ +struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_filter_ptr called!\n"); abort(); } /* Generated stub for command_its_complicated */ struct command_result *command_its_complicated(const char *why UNNEEDED) { fprintf(stderr, "command_its_complicated called!\n"); abort(); } +/* Generated stub for command_log */ +void command_log(struct command *cmd UNNEEDED, enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_log called!\n"); abort(); } /* Generated stub for command_logger */ struct logger *command_logger(struct command *cmd UNNEEDED) { fprintf(stderr, "command_logger called!\n"); abort(); } @@ -207,6 +178,9 @@ struct logger *command_logger(struct command *cmd UNNEEDED) struct command_result *command_param_failed(void) { fprintf(stderr, "command_param_failed called!\n"); abort(); } +/* Generated stub for command_set_usage */ +void command_set_usage(struct command *cmd UNNEEDED, const char *usage UNNEEDED) +{ fprintf(stderr, "command_set_usage called!\n"); abort(); } /* Generated stub for command_still_pending */ struct command_result *command_still_pending(struct command *cmd) @@ -216,6 +190,9 @@ struct command_result *command_success(struct command *cmd UNNEEDED, struct json_stream *response) { fprintf(stderr, "command_success called!\n"); abort(); } +/* Generated stub for command_usage_only */ +bool command_usage_only(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_usage_only called!\n"); abort(); } /* Generated stub for commit_tx_boost */ void commit_tx_boost(struct channel *channel UNNEEDED, struct anchor_details *adet UNNEEDED, @@ -256,33 +233,9 @@ bool depthcb_update_scid(struct channel *channel UNNEEDED, /* Generated stub for dev_disconnect_permanent */ bool dev_disconnect_permanent(struct lightningd *ld UNNEEDED) { fprintf(stderr, "dev_disconnect_permanent called!\n"); abort(); } -/* Generated stub for encode_scriptpubkey_to_addr */ -char *encode_scriptpubkey_to_addr(const tal_t *ctx UNNEEDED, - const struct chainparams *chainparams UNNEEDED, - const u8 *scriptpubkey UNNEEDED) -{ fprintf(stderr, "encode_scriptpubkey_to_addr called!\n"); abort(); } -/* Generated stub for encrypt_tlv_encrypted_data */ -u8 *encrypt_tlv_encrypted_data(const tal_t *ctx UNNEEDED, - const struct privkey *path_privkey UNNEEDED, - const struct pubkey *node UNNEEDED, - const struct tlv_encrypted_data_tlv *tlv UNNEEDED, - struct privkey *next_path_privkey UNNEEDED, - struct pubkey *node_alias) - -{ fprintf(stderr, "encrypt_tlv_encrypted_data called!\n"); abort(); } /* Generated stub for fatal */ void fatal(const char *fmt UNNEEDED, ...) { fprintf(stderr, "fatal called!\n"); abort(); } -/* 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 featurebits_or */ -u8 *featurebits_or(const tal_t *ctx UNNEEDED, const u8 *f1 TAKES UNNEEDED, const u8 *f2 TAKES UNNEEDED) -{ fprintf(stderr, "featurebits_or called!\n"); abort(); } /* Generated stub for find_channel_by_id */ struct channel *find_channel_by_id(const struct peer *peer UNNEEDED, const struct channel_id *cid UNNEEDED) @@ -294,24 +247,11 @@ struct plugin *find_plugin_for_command(struct lightningd *ld UNNEEDED, /* Generated stub for fixup_htlcs_out */ void fixup_htlcs_out(struct lightningd *ld UNNEEDED) { fprintf(stderr, "fixup_htlcs_out called!\n"); abort(); } -/* Generated stub for fmt_channel_id */ -char *fmt_channel_id(const tal_t *ctx UNNEEDED, const struct channel_id *channel_id UNNEEDED) -{ fprintf(stderr, "fmt_channel_id called!\n"); abort(); } -/* Generated stub for fmt_node_id */ -char *fmt_node_id(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "fmt_node_id called!\n"); abort(); } /* Generated stub for force_peer_disconnect */ void force_peer_disconnect(struct lightningd *ld UNNEEDED, const struct peer *peer UNNEEDED, const char *why UNNEEDED) { fprintf(stderr, "force_peer_disconnect 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(); } -/* Generated stub for fromwire_channel_id */ -bool 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_channeld_dev_memleak_reply */ bool fromwire_channeld_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNEEDED) { fprintf(stderr, "fromwire_channeld_dev_memleak_reply called!\n"); abort(); } @@ -351,9 +291,6 @@ bool fromwire_hsmd_sign_commitment_tx_reply(const void *p UNNEEDED, struct bitco /* Generated stub for fromwire_hsmd_sign_invoice_reply */ bool fromwire_hsmd_sign_invoice_reply(const void *p UNNEEDED, secp256k1_ecdsa_recoverable_signature *sig UNNEEDED) { fprintf(stderr, "fromwire_hsmd_sign_invoice_reply 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(); } /* Generated stub for fromwire_onchaind_dev_memleak_reply */ bool fromwire_onchaind_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNEEDED) { fprintf(stderr, "fromwire_onchaind_dev_memleak_reply called!\n"); abort(); } @@ -363,11 +300,6 @@ bool fromwire_openingd_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNE /* Generated stub for get_block_height */ u32 get_block_height(const struct chain_topology *topo UNNEEDED) { fprintf(stderr, "get_block_height called!\n"); abort(); } -/* Generated stub for get_feerate */ -u32 get_feerate(const struct fee_states *fee_states UNNEEDED, - enum side opener UNNEEDED, - enum side side UNNEEDED) -{ fprintf(stderr, "get_feerate called!\n"); abort(); } /* Generated stub for hash_cid */ size_t hash_cid(const struct channel_id *cid UNNEEDED) { fprintf(stderr, "hash_cid called!\n"); abort(); } @@ -382,15 +314,6 @@ const u8 *hsm_sync_req(const tal_t *ctx UNNEEDED, struct lightningd *ld UNNEEDED, const u8 *msg TAKES UNNEEDED) { fprintf(stderr, "hsm_sync_req called!\n"); abort(); } -/* Generated stub for htlc_is_trimmed */ -bool htlc_is_trimmed(enum side htlc_owner UNNEEDED, - struct amount_msat htlc_amount UNNEEDED, - u32 feerate_per_kw UNNEEDED, - struct amount_sat dust_limit UNNEEDED, - enum side side UNNEEDED, - bool option_anchor_outputs UNNEEDED, - bool option_anchors_zero_fee_htlc_tx UNNEEDED) -{ fprintf(stderr, "htlc_is_trimmed called!\n"); abort(); } /* Generated stub for htlc_max_possible_send */ struct amount_msat htlc_max_possible_send(const struct channel *channel UNNEEDED) { fprintf(stderr, "htlc_max_possible_send called!\n"); abort(); } @@ -401,26 +324,6 @@ void htlc_set_fail_(struct htlc_set *set UNNEEDED, const u8 *failmsg TAKES UNNEE /* Generated stub for htlc_set_fulfill */ void htlc_set_fulfill(struct htlc_set *set UNNEEDED, const struct preimage *preimage UNNEEDED) { fprintf(stderr, "htlc_set_fulfill called!\n"); abort(); } -/* Generated stub for invoice_decode */ -struct tlv_invoice *invoice_decode(const tal_t *ctx UNNEEDED, - const char *b12 UNNEEDED, size_t b12len UNNEEDED, - const struct feature_set *our_features UNNEEDED, - const struct chainparams *must_be_chain UNNEEDED, - char **fail UNNEEDED) -{ fprintf(stderr, "invoice_decode called!\n"); abort(); } -/* Generated stub for invoice_decode_minimal */ -struct tlv_invoice *invoice_decode_minimal(const tal_t *ctx UNNEEDED, - const char *b12 UNNEEDED, size_t b12len UNNEEDED, - const struct feature_set *our_features UNNEEDED, - const struct chainparams *must_be_chain UNNEEDED, - char **fail UNNEEDED) -{ fprintf(stderr, "invoice_decode_minimal called!\n"); abort(); } -/* Generated stub for invoice_encode */ -char *invoice_encode(const tal_t *ctx UNNEEDED, const struct tlv_invoice *bolt12_tlv UNNEEDED) -{ fprintf(stderr, "invoice_encode called!\n"); abort(); } -/* Generated stub for invoice_offer_id */ -void invoice_offer_id(const struct tlv_invoice *invoice UNNEEDED, struct sha256 *id UNNEEDED) -{ fprintf(stderr, "invoice_offer_id called!\n"); abort(); } /* Generated stub for invoices_create */ bool invoices_create(struct invoices *invoices UNNEEDED, u64 *inv_dbid UNNEEDED, @@ -510,121 +413,12 @@ void invoices_waitone(const tal_t *ctx UNNEEDED, void (*cb)(const u64 * UNNEEDED, void*) UNNEEDED, void *cbarg UNNEEDED) { fprintf(stderr, "invoices_waitone called!\n"); abort(); } -/* Generated stub for json_add_address */ -void json_add_address(struct json_stream *response UNNEEDED, const char *fieldname UNNEEDED, - const struct wireaddr *addr UNNEEDED) -{ fprintf(stderr, "json_add_address called!\n"); abort(); } -/* Generated stub for json_add_address_internal */ -void json_add_address_internal(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct wireaddr_internal *addr UNNEEDED) -{ fprintf(stderr, "json_add_address_internal called!\n"); abort(); } -/* Generated stub for json_add_amount_msat */ -void json_add_amount_msat(struct json_stream *result UNNEEDED, - const char *msatfieldname UNNEEDED, - struct amount_msat msat) - -{ fprintf(stderr, "json_add_amount_msat called!\n"); abort(); } -/* Generated stub for json_add_amount_sat_msat */ -void json_add_amount_sat_msat(struct json_stream *result UNNEEDED, - const char *msatfieldname UNNEEDED, - struct amount_sat sat) - -{ fprintf(stderr, "json_add_amount_sat_msat called!\n"); abort(); } -/* Generated stub for json_add_bolt11 */ -void json_add_bolt11(struct json_stream *response UNNEEDED, - const struct bolt11 *b11 UNNEEDED) -{ fprintf(stderr, "json_add_bolt11 called!\n"); abort(); } -/* Generated stub for json_add_bool */ -void json_add_bool(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - bool value UNNEEDED) -{ fprintf(stderr, "json_add_bool called!\n"); abort(); } -/* Generated stub for json_add_channel_type */ -void json_add_channel_type(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct channel_type *channel_type UNNEEDED) -{ fprintf(stderr, "json_add_channel_type called!\n"); abort(); } -/* Generated stub for json_add_escaped_string */ -void json_add_escaped_string(struct json_stream *result UNNEEDED, - const char *fieldname UNNEEDED, - const struct json_escape *esc TAKES UNNEEDED) -{ fprintf(stderr, "json_add_escaped_string called!\n"); abort(); } -/* Generated stub for json_add_hex_talarr */ -void json_add_hex_talarr(struct json_stream *result UNNEEDED, - const char *fieldname UNNEEDED, - const tal_t *data UNNEEDED) -{ fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); } -/* Generated stub for json_add_invstring */ -void json_add_invstring(struct json_stream *result UNNEEDED, const char *invstring UNNEEDED) -{ fprintf(stderr, "json_add_invstring called!\n"); abort(); } /* Generated stub for json_add_log */ void json_add_log(struct json_stream *result UNNEEDED, const struct log_book *log_book UNNEEDED, const struct node_id *node_id UNNEEDED, enum log_level minlevel UNNEEDED) { fprintf(stderr, "json_add_log called!\n"); abort(); } -/* Generated stub for json_add_node_id */ -void json_add_node_id(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct node_id *id UNNEEDED) -{ fprintf(stderr, "json_add_node_id called!\n"); abort(); } -/* Generated stub for json_add_num */ -void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - unsigned int value UNNEEDED) -{ fprintf(stderr, "json_add_num called!\n"); abort(); } -/* Generated stub for json_add_preimage */ -void json_add_preimage(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const struct preimage *preimage UNNEEDED) -{ fprintf(stderr, "json_add_preimage called!\n"); abort(); } -/* Generated stub for json_add_s64 */ -void json_add_s64(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - int64_t value UNNEEDED) -{ fprintf(stderr, "json_add_s64 called!\n"); abort(); } -/* Generated stub for json_add_secret */ -void json_add_secret(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct secret *secret UNNEEDED) -{ fprintf(stderr, "json_add_secret called!\n"); abort(); } -/* Generated stub for json_add_sha256 */ -void json_add_sha256(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const struct sha256 *hash UNNEEDED) -{ fprintf(stderr, "json_add_sha256 called!\n"); abort(); } -/* Generated stub for json_add_short_channel_id */ -void json_add_short_channel_id(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - struct short_channel_id id UNNEEDED) -{ fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); } -/* Generated stub for json_add_string */ -void json_add_string(struct json_stream *js UNNEEDED, - const char *fieldname UNNEEDED, - const char *str TAKES UNNEEDED) -{ fprintf(stderr, "json_add_string called!\n"); abort(); } -/* Generated stub for json_add_stringn */ -void json_add_stringn(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const char *value TAKES UNNEEDED, size_t value_len UNNEEDED) -{ fprintf(stderr, "json_add_stringn called!\n"); abort(); } -/* Generated stub for json_add_timeiso */ -void json_add_timeiso(struct json_stream *result UNNEEDED, - const char *fieldname UNNEEDED, - struct timeabs time UNNEEDED) -{ fprintf(stderr, "json_add_timeiso called!\n"); abort(); } -/* Generated stub for json_add_tx */ -void json_add_tx(struct json_stream *result UNNEEDED, - const char *fieldname UNNEEDED, - const struct bitcoin_tx *tx UNNEEDED) -{ fprintf(stderr, "json_add_tx called!\n"); abort(); } -/* Generated stub for json_add_txid */ -void json_add_txid(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const struct bitcoin_txid *txid UNNEEDED) -{ fprintf(stderr, "json_add_txid called!\n"); abort(); } -/* Generated stub for json_add_u32 */ -void json_add_u32(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - uint32_t value UNNEEDED) -{ fprintf(stderr, "json_add_u32 called!\n"); abort(); } -/* Generated stub for json_add_u64 */ -void json_add_u64(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - uint64_t value UNNEEDED) -{ fprintf(stderr, "json_add_u64 called!\n"); abort(); } /* Generated stub for json_add_uncommitted_channel */ void json_add_uncommitted_channel(struct command *cmd UNNEEDED, struct json_stream *response UNNEEDED, @@ -637,25 +431,6 @@ void json_add_unsaved_channel(struct command *cmd UNNEEDED, const struct channel *channel UNNEEDED, const struct peer *peer UNNEEDED) { fprintf(stderr, "json_add_unsaved_channel called!\n"); abort(); } -/* Generated stub for json_array_end */ -void json_array_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_array_end called!\n"); abort(); } -/* Generated stub for json_array_start */ -void json_array_start(struct json_stream *js UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_array_start called!\n"); abort(); } -/* Generated stub for json_object_end */ -void json_object_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_object_end called!\n"); abort(); } -/* Generated stub for json_object_start */ -void json_object_start(struct json_stream *ks UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_object_start called!\n"); abort(); } -/* Generated stub for json_scan */ -const char *json_scan(const tal_t *ctx UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - const char *guide UNNEEDED, - ...) -{ fprintf(stderr, "json_scan called!\n"); abort(); } /* Generated stub for json_stream_fail */ struct json_stream *json_stream_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, @@ -664,39 +439,6 @@ struct json_stream *json_stream_fail(struct command *cmd UNNEEDED, /* Generated stub for json_stream_success */ struct json_stream *json_stream_success(struct command *cmd UNNEEDED) { fprintf(stderr, "json_stream_success called!\n"); abort(); } -/* Generated stub for json_to_address_scriptpubkey */ -enum address_parse_result json_to_address_scriptpubkey(const tal_t *ctx UNNEEDED, - const struct chainparams *chainparams UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, const u8 **scriptpubkey UNNEEDED) -{ fprintf(stderr, "json_to_address_scriptpubkey called!\n"); abort(); } -/* Generated stub for json_to_msat */ -bool json_to_msat(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct amount_msat *msat UNNEEDED) -{ fprintf(stderr, "json_to_msat called!\n"); abort(); } -/* Generated stub for json_to_node_id */ -bool json_to_node_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct node_id *id UNNEEDED) -{ fprintf(stderr, "json_to_node_id called!\n"); abort(); } -/* Generated stub for json_to_number */ -bool json_to_number(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - unsigned int *num UNNEEDED) -{ fprintf(stderr, "json_to_number called!\n"); abort(); } -/* Generated stub for json_to_short_channel_id */ -bool json_to_short_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct short_channel_id *scid UNNEEDED) -{ fprintf(stderr, "json_to_short_channel_id called!\n"); abort(); } -/* Generated stub for json_to_u16 */ -bool json_to_u16(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - uint16_t *num UNNEEDED) -{ fprintf(stderr, "json_to_u16 called!\n"); abort(); } -/* Generated stub for json_tok_bin_from_hex */ -u8 *json_tok_bin_from_hex(const tal_t *ctx UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED) -{ fprintf(stderr, "json_tok_bin_from_hex called!\n"); abort(); } -/* Generated stub for json_tok_channel_id */ -bool json_tok_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct channel_id *cid UNNEEDED) -{ fprintf(stderr, "json_tok_channel_id called!\n"); abort(); } /* Generated stub for jsonrpc_request_end */ void jsonrpc_request_end(struct jsonrpc_request *request UNNEEDED) { fprintf(stderr, "jsonrpc_request_end called!\n"); abort(); } @@ -732,30 +474,9 @@ void log_(struct logger *logger UNNEEDED, enum log_level level UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "log_ called!\n"); abort(); } -/* Generated stub for marginal_feerate */ -u32 marginal_feerate(u32 current_feerate UNNEEDED) -{ fprintf(stderr, "marginal_feerate called!\n"); abort(); } -/* Generated stub for merkle_tlv */ -void merkle_tlv(const struct tlv_field *fields UNNEEDED, struct sha256 *merkle UNNEEDED) -{ fprintf(stderr, "merkle_tlv called!\n"); abort(); } -/* Generated stub for new_bolt11 */ -struct bolt11 *new_bolt11(const tal_t *ctx UNNEEDED, - const struct amount_msat *msat TAKES UNNEEDED) -{ fprintf(stderr, "new_bolt11 called!\n"); abort(); } -/* Generated stub for new_height_states */ -struct height_states *new_height_states(const tal_t *ctx UNNEEDED, - enum side opener UNNEEDED, - const u32 *blockheight UNNEEDED) -{ fprintf(stderr, "new_height_states called!\n"); abort(); } /* Generated stub for new_peer_fd */ struct peer_fd *new_peer_fd(const tal_t *ctx UNNEEDED, int peer_fd UNNEEDED) { fprintf(stderr, "new_peer_fd called!\n"); abort(); } -/* Generated stub for new_reltimer_ */ -struct oneshot *new_reltimer_(struct timers *timers UNNEEDED, - const tal_t *ctx UNNEEDED, - struct timerel expire UNNEEDED, - void (*cb)(void *) UNNEEDED, void *arg UNNEEDED) -{ fprintf(stderr, "new_reltimer_ called!\n"); abort(); } /* Generated stub for new_uncommitted_channel */ struct uncommitted_channel *new_uncommitted_channel(struct peer *peer UNNEEDED) { fprintf(stderr, "new_uncommitted_channel called!\n"); abort(); } @@ -768,9 +489,6 @@ struct channel *new_unsaved_channel(struct peer *peer UNNEEDED, bool newaddr_inner(struct command *cmd UNNEEDED, struct pubkey *pubkey UNNEEDED, enum addrtype addrtype UNNEEDED) { fprintf(stderr, "newaddr_inner called!\n"); abort(); } -/* Generated stub for node_id_cmp */ -int node_id_cmp(const struct node_id *a UNNEEDED, const struct node_id *b UNNEEDED) -{ fprintf(stderr, "node_id_cmp called!\n"); abort(); } /* Generated stub for notify_connect */ void notify_connect(struct lightningd *ld UNNEEDED, const struct node_id *nodeid UNNEEDED, @@ -798,55 +516,12 @@ enum watch_result onchaind_funding_spent(struct channel *channel UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, u32 blockheight UNNEEDED) { fprintf(stderr, "onchaind_funding_spent called!\n"); abort(); } -/* Generated stub for param */ -bool param(struct command *cmd UNNEEDED, const char *buffer UNNEEDED, - const jsmntok_t params[] UNNEEDED, ...) -{ fprintf(stderr, "param called!\n"); abort(); } -/* Generated stub for param_array */ -struct command_result *param_array(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - const jsmntok_t **arr UNNEEDED) -{ fprintf(stderr, "param_array called!\n"); abort(); } -/* Generated stub for param_bool */ -struct command_result *param_bool(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - bool **b UNNEEDED) -{ fprintf(stderr, "param_bool called!\n"); abort(); } -/* Generated stub for param_channel_id */ -struct command_result *param_channel_id(struct command *cmd UNNEEDED, - const char *name UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - struct channel_id **cid UNNEEDED) -{ fprintf(stderr, "param_channel_id called!\n"); abort(); } -/* Generated stub for param_check */ -bool param_check(struct command *cmd UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t tokens[] UNNEEDED, ...) -{ fprintf(stderr, "param_check called!\n"); abort(); } -/* Generated stub for param_escaped_string */ -struct command_result *param_escaped_string(struct command *cmd UNNEEDED, - const char *name UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - const char **str UNNEEDED) -{ fprintf(stderr, "param_escaped_string called!\n"); abort(); } /* Generated stub for param_index */ struct command_result *param_index(struct command *cmd UNNEEDED, const char *name UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, enum wait_index **index UNNEEDED) { fprintf(stderr, "param_index called!\n"); abort(); } -/* Generated stub for param_invstring */ -struct command_result *param_invstring(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char * buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - const char **str UNNEEDED) -{ fprintf(stderr, "param_invstring called!\n"); abort(); } -/* Generated stub for param_label */ -struct command_result *param_label(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char * buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct json_escape **label UNNEEDED) -{ fprintf(stderr, "param_label called!\n"); abort(); } /* Generated stub for param_loglevel */ struct command_result *param_loglevel(struct command *cmd UNNEEDED, const char *name UNNEEDED, @@ -854,50 +529,6 @@ struct command_result *param_loglevel(struct command *cmd UNNEEDED, const jsmntok_t *tok UNNEEDED, enum log_level **level UNNEEDED) { fprintf(stderr, "param_loglevel called!\n"); abort(); } -/* Generated stub for param_msat */ -struct command_result *param_msat(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct amount_msat **msat UNNEEDED) -{ fprintf(stderr, "param_msat called!\n"); abort(); } -/* Generated stub for param_node_id */ -struct command_result *param_node_id(struct command *cmd UNNEEDED, - const char *name UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - struct node_id **id UNNEEDED) -{ fprintf(stderr, "param_node_id called!\n"); abort(); } -/* Generated stub for param_number */ -struct command_result *param_number(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - unsigned int **num UNNEEDED) -{ fprintf(stderr, "param_number called!\n"); abort(); } -/* Generated stub for param_sha256 */ -struct command_result *param_sha256(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct sha256 **hash UNNEEDED) -{ fprintf(stderr, "param_sha256 called!\n"); abort(); } -/* Generated stub for param_short_channel_id */ -struct command_result *param_short_channel_id(struct command *cmd UNNEEDED, - const char *name UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - struct short_channel_id **scid UNNEEDED) -{ fprintf(stderr, "param_short_channel_id called!\n"); abort(); } -/* Generated stub for param_string */ -struct command_result *param_string(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char * buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - const char **str UNNEEDED) -{ fprintf(stderr, "param_string called!\n"); abort(); } -/* Generated stub for param_u32 */ -struct command_result *param_u32(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - uint32_t **num UNNEEDED) -{ fprintf(stderr, "param_u32 called!\n"); abort(); } -/* Generated stub for param_u64 */ -struct command_result *param_u64(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - uint64_t **num UNNEEDED) -{ fprintf(stderr, "param_u64 called!\n"); abort(); } /* Generated stub for peer_any_channel_bystate */ struct channel *peer_any_channel_bystate(struct peer *peer UNNEEDED, bool (*channel_state_filter)(enum channel_state) UNNEEDED, @@ -933,9 +564,6 @@ bool plugin_hook_call_(struct lightningd *ld UNNEEDED, void plugin_request_send(struct plugin *plugin UNNEEDED, struct jsonrpc_request *req UNNEEDED) { fprintf(stderr, "plugin_request_send called!\n"); abort(); } -/* Generated stub for pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } /* Generated stub for report_subd_memleak */ void report_subd_memleak(struct leak_detect *leak_detect UNNEEDED, struct subd *leaker UNNEEDED) { fprintf(stderr, "report_subd_memleak called!\n"); abort(); } @@ -943,14 +571,6 @@ void report_subd_memleak(struct leak_detect *leak_detect UNNEEDED, struct subd * void resolve_close_command(struct lightningd *ld UNNEEDED, struct channel *channel UNNEEDED, bool cooperative UNNEEDED, const struct bitcoin_tx **close_txs UNNEEDED) { fprintf(stderr, "resolve_close_command called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace called!\n"); abort(); } -/* Generated stub for shachain_get_secret */ -bool shachain_get_secret(const struct shachain *shachain UNNEEDED, - u64 commit_num UNNEEDED, - struct secret *preimage UNNEEDED) -{ fprintf(stderr, "shachain_get_secret called!\n"); abort(); } /* Generated stub for start_leak_request */ void start_leak_request(const struct subd_req *req UNNEEDED, struct leak_detect *leak_detect UNNEEDED) @@ -969,12 +589,6 @@ void subd_send_fd(struct subd *sd UNNEEDED, int fd UNNEEDED) /* Generated stub for subd_send_msg */ void subd_send_msg(struct subd *sd UNNEEDED, const u8 *msg_out UNNEEDED) { fprintf(stderr, "subd_send_msg 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_channeld_dev_memleak */ u8 *towire_channeld_dev_memleak(const tal_t *ctx UNNEEDED) { fprintf(stderr, "towire_channeld_dev_memleak called!\n"); abort(); } @@ -993,11 +607,6 @@ u8 *towire_connectd_peer_send_msg(const tal_t *ctx UNNEEDED, const struct node_i /* Generated stub for towire_dualopend_dev_memleak */ u8 *towire_dualopend_dev_memleak(const tal_t *ctx UNNEEDED) { fprintf(stderr, "towire_dualopend_dev_memleak called!\n"); abort(); } -/* Generated stub for towire_errorfmt */ -u8 *towire_errorfmt(const tal_t *ctx UNNEEDED, - const struct channel_id *channel UNNEEDED, - const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "towire_errorfmt called!\n"); abort(); } /* Generated stub for towire_hsmd_preapprove_invoice */ u8 *towire_hsmd_preapprove_invoice(const tal_t *ctx UNNEEDED, const wirestring *invstring UNNEEDED) { fprintf(stderr, "towire_hsmd_preapprove_invoice called!\n"); abort(); } @@ -1019,26 +628,12 @@ u8 *towire_hsmd_sign_commitment_tx(const tal_t *ctx UNNEEDED, const struct node_ /* Generated stub for towire_hsmd_sign_invoice */ u8 *towire_hsmd_sign_invoice(const tal_t *ctx UNNEEDED, const u8 *u5bytes UNNEEDED, const u8 *hrp UNNEEDED) { fprintf(stderr, "towire_hsmd_sign_invoice called!\n"); abort(); } -/* Generated stub for towire_modern_scb_chan */ -void towire_modern_scb_chan(u8 **p UNNEEDED, const struct modern_scb_chan *modern_scb_chan UNNEEDED) -{ fprintf(stderr, "towire_modern_scb_chan 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(); } /* Generated stub for towire_onchaind_dev_memleak */ u8 *towire_onchaind_dev_memleak(const tal_t *ctx UNNEEDED) { fprintf(stderr, "towire_onchaind_dev_memleak called!\n"); abort(); } /* Generated stub for towire_openingd_dev_memleak */ u8 *towire_openingd_dev_memleak(const tal_t *ctx UNNEEDED) { fprintf(stderr, "towire_openingd_dev_memleak called!\n"); abort(); } -/* Generated stub for towire_warningfmt */ -u8 *towire_warningfmt(const tal_t *ctx UNNEEDED, - const struct channel_id *channel UNNEEDED, - const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "towire_warningfmt called!\n"); abort(); } -/* Generated stub for version */ -const char *version(void) -{ fprintf(stderr, "version called!\n"); abort(); } /* Generated stub for wallet_channel_save */ void wallet_channel_save(struct wallet *w UNNEEDED, struct channel *chan UNNEEDED) { fprintf(stderr, "wallet_channel_save called!\n"); abort(); } diff --git a/lightningd/test/run-jsonrpc.c b/lightningd/test/run-jsonrpc.c index cf064ca891a4..c25cb535d7e6 100644 --- a/lightningd/test/run-jsonrpc.c +++ b/lightningd/test/run-jsonrpc.c @@ -8,13 +8,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for command_fail_badparam */ -struct command_result *command_fail_badparam(struct command *cmd UNNEEDED, - const char *paramname UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - const char *msg UNNEEDED) -{ fprintf(stderr, "command_fail_badparam called!\n"); abort(); } /* Generated stub for db_begin_transaction_ */ void db_begin_transaction_(struct db *db UNNEEDED, const char *location UNNEEDED) { fprintf(stderr, "db_begin_transaction_ called!\n"); abort(); } @@ -33,16 +26,6 @@ void fatal(const char *fmt UNNEEDED, ...) /* Generated stub for feerate_for_deadline */ u32 feerate_for_deadline(const struct chain_topology *topo UNNEEDED, u32 blockcount UNNEEDED) { fprintf(stderr, "feerate_for_deadline 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(); } -/* Generated stub for fromwire_channel_id */ -bool 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_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 get_feerate_floor */ u32 get_feerate_floor(const struct chain_topology *topo UNNEEDED) { fprintf(stderr, "get_feerate_floor called!\n"); abort(); } @@ -51,14 +34,6 @@ char *hsm_secret_arg(const tal_t *ctx UNNEEDED, const char *arg UNNEEDED, const u8 **hsm_secret UNNEEDED) { fprintf(stderr, "hsm_secret_arg called!\n"); abort(); } -/* Generated stub for json_to_jsonrpc_errcode */ -bool json_to_jsonrpc_errcode(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - enum jsonrpc_errcode *errcode UNNEEDED) -{ fprintf(stderr, "json_to_jsonrpc_errcode called!\n"); abort(); } -/* Generated stub for json_to_number */ -bool json_to_number(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - unsigned int *num UNNEEDED) -{ fprintf(stderr, "json_to_number called!\n"); abort(); } /* Generated stub for lightningd_deprecated_in_ok */ bool lightningd_deprecated_in_ok(struct lightningd *ld UNNEEDED, struct logger *log UNNEEDED, @@ -90,9 +65,6 @@ void log_io(struct logger *logger UNNEEDED, enum log_level dir UNNEEDED, const char *comment UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) { fprintf(stderr, "log_io called!\n"); abort(); } -/* Generated stub for log_level_name */ -const char *log_level_name(enum log_level level UNNEEDED) -{ fprintf(stderr, "log_level_name called!\n"); abort(); } /* Generated stub for mutual_close_feerate */ u32 mutual_close_feerate(struct chain_topology *topo UNNEEDED) { fprintf(stderr, "mutual_close_feerate called!\n"); abort(); } @@ -101,54 +73,9 @@ struct logger *new_logger(const tal_t *ctx UNNEEDED, struct log_book *record UNN const struct node_id *default_node_id UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "new_logger called!\n"); abort(); } -/* Generated stub for new_reltimer_ */ -struct oneshot *new_reltimer_(struct timers *timers UNNEEDED, - const tal_t *ctx UNNEEDED, - struct timerel expire UNNEEDED, - void (*cb)(void *) UNNEEDED, void *arg UNNEEDED) -{ fprintf(stderr, "new_reltimer_ called!\n"); abort(); } /* Generated stub for opening_feerate */ u32 opening_feerate(struct chain_topology *topo UNNEEDED) { fprintf(stderr, "opening_feerate called!\n"); abort(); } -/* Generated stub for param */ -bool param(struct command *cmd UNNEEDED, const char *buffer UNNEEDED, - const jsmntok_t params[] UNNEEDED, ...) -{ fprintf(stderr, "param called!\n"); abort(); } -/* Generated stub for param_bool */ -struct command_result *param_bool(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - bool **b UNNEEDED) -{ fprintf(stderr, "param_bool called!\n"); abort(); } -/* Generated stub for param_check */ -bool param_check(struct command *cmd UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t tokens[] UNNEEDED, ...) -{ fprintf(stderr, "param_check called!\n"); abort(); } -/* Generated stub for param_ignore */ -struct command_result *param_ignore(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - const void *unused UNNEEDED) -{ fprintf(stderr, "param_ignore called!\n"); abort(); } -/* Generated stub for param_number */ -struct command_result *param_number(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - unsigned int **num UNNEEDED) -{ fprintf(stderr, "param_number called!\n"); abort(); } -/* Generated stub for param_sha256 */ -struct command_result *param_sha256(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct sha256 **hash UNNEEDED) -{ fprintf(stderr, "param_sha256 called!\n"); abort(); } -/* Generated stub for param_string */ -struct command_result *param_string(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char * buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - const char **str UNNEEDED) -{ fprintf(stderr, "param_string called!\n"); abort(); } -/* Generated stub for param_subcommand */ -const char *param_subcommand(struct command *cmd UNNEEDED, const char *buffer UNNEEDED, - const jsmntok_t tokens[] UNNEEDED, - const char *name UNNEEDED, ...) -{ fprintf(stderr, "param_subcommand called!\n"); abort(); } /* Generated stub for penalty_feerate */ u32 penalty_feerate(struct chain_topology *topo UNNEEDED) { fprintf(stderr, "penalty_feerate called!\n"); abort(); } @@ -158,30 +85,6 @@ bool plugin_hook_call_(struct lightningd *ld UNNEEDED, const char *cmd_id TAKES UNNEEDED, tal_t *cb_arg STEALS UNNEEDED) { fprintf(stderr, "plugin_hook_call_ called!\n"); abort(); } -/* Generated stub for pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace 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_node_id */ -void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "towire_node_id called!\n"); abort(); } -/* Generated stub for trace_span_end */ -void trace_span_end(const void *key UNNEEDED) -{ fprintf(stderr, "trace_span_end called!\n"); abort(); } -/* Generated stub for trace_span_start_ */ -void trace_span_start_(const char *name UNNEEDED, const void *key UNNEEDED) -{ fprintf(stderr, "trace_span_start_ called!\n"); abort(); } -/* Generated stub for trace_span_tag */ -void trace_span_tag(const void *key UNNEEDED, const char *name UNNEEDED, const char *value UNNEEDED) -{ fprintf(stderr, "trace_span_tag called!\n"); abort(); } /* Generated stub for unilateral_feerate */ u32 unilateral_feerate(struct chain_topology *topo UNNEEDED, bool option_anchors UNNEEDED) { fprintf(stderr, "unilateral_feerate called!\n"); abort(); } diff --git a/lightningd/test/run-log-pruning.c b/lightningd/test/run-log-pruning.c index e20154e860cd..893c7071b34c 100644 --- a/lightningd/test/run-log-pruning.c +++ b/lightningd/test/run-log-pruning.c @@ -4,75 +4,50 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for command_fail_badparam */ -struct command_result *command_fail_badparam(struct command *cmd UNNEEDED, - const char *paramname UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - const char *msg UNNEEDED) -{ fprintf(stderr, "command_fail_badparam called!\n"); abort(); } +/* Generated stub for command_check_done */ +struct command_result *command_check_done(struct command *cmd) + +{ fprintf(stderr, "command_check_done called!\n"); abort(); } +/* Generated stub for command_check_only */ +bool command_check_only(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_check_only called!\n"); abort(); } +/* Generated stub for command_deprecated_in_ok */ +bool command_deprecated_in_ok(struct command *cmd UNNEEDED, + const char *param UNNEEDED, + const char *depr_start UNNEEDED, + const char *depr_end UNNEEDED) +{ fprintf(stderr, "command_deprecated_in_ok called!\n"); abort(); } +/* Generated stub for command_dev_apis */ +bool command_dev_apis(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_dev_apis called!\n"); abort(); } +/* Generated stub for command_fail */ +struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_fail called!\n"); abort(); } +/* Generated stub for command_filter_ptr */ +struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_filter_ptr called!\n"); abort(); } +/* Generated stub for command_log */ +void command_log(struct command *cmd UNNEEDED, enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_log called!\n"); abort(); } /* Generated stub for command_param_failed */ struct command_result *command_param_failed(void) { fprintf(stderr, "command_param_failed called!\n"); abort(); } +/* Generated stub for command_set_usage */ +void command_set_usage(struct command *cmd UNNEEDED, const char *usage UNNEEDED) +{ fprintf(stderr, "command_set_usage called!\n"); abort(); } /* Generated stub for command_success */ struct command_result *command_success(struct command *cmd UNNEEDED, struct json_stream *response) { fprintf(stderr, "command_success called!\n"); abort(); } -/* Generated stub for fmt_node_id */ -char *fmt_node_id(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "fmt_node_id 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(); } -/* Generated stub for fromwire_channel_id */ -bool 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_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 json_add_hex_talarr */ -void json_add_hex_talarr(struct json_stream *result UNNEEDED, - const char *fieldname UNNEEDED, - const tal_t *data UNNEEDED) -{ fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); } -/* Generated stub for json_add_node_id */ -void json_add_node_id(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct node_id *id UNNEEDED) -{ fprintf(stderr, "json_add_node_id called!\n"); abort(); } -/* Generated stub for json_add_num */ -void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - unsigned int value UNNEEDED) -{ fprintf(stderr, "json_add_num called!\n"); abort(); } -/* Generated stub for json_add_str_fmt */ -void json_add_str_fmt(struct json_stream *js UNNEEDED, - const char *fieldname UNNEEDED, - const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "json_add_str_fmt called!\n"); abort(); } -/* Generated stub for json_add_string */ -void json_add_string(struct json_stream *js UNNEEDED, - const char *fieldname UNNEEDED, - const char *str TAKES UNNEEDED) -{ fprintf(stderr, "json_add_string called!\n"); abort(); } -/* Generated stub for json_add_timestr */ -void json_add_timestr(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - struct timespec ts UNNEEDED) -{ fprintf(stderr, "json_add_timestr called!\n"); abort(); } -/* Generated stub for json_array_end */ -void json_array_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_array_end called!\n"); abort(); } -/* Generated stub for json_array_start */ -void json_array_start(struct json_stream *js UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_array_start called!\n"); abort(); } -/* Generated stub for json_object_end */ -void json_object_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_object_end called!\n"); abort(); } -/* Generated stub for json_object_start */ -void json_object_start(struct json_stream *ks UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_object_start called!\n"); abort(); } +/* Generated stub for command_usage_only */ +bool command_usage_only(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_usage_only called!\n"); abort(); } /* Generated stub for json_stream_log_suppress_for_cmd */ void json_stream_log_suppress_for_cmd(struct json_stream *js UNNEEDED, const struct command *cmd UNNEEDED) @@ -80,38 +55,12 @@ void json_stream_log_suppress_for_cmd(struct json_stream *js UNNEEDED, /* Generated stub for json_stream_success */ struct json_stream *json_stream_success(struct command *cmd UNNEEDED) { fprintf(stderr, "json_stream_success called!\n"); abort(); } -/* Generated stub for log_level_name */ -const char *log_level_name(enum log_level level UNNEEDED) -{ fprintf(stderr, "log_level_name called!\n"); abort(); } -/* Generated stub for log_level_parse */ -bool log_level_parse(const char *levelstr UNNEEDED, size_t len UNNEEDED, - enum log_level *level UNNEEDED) -{ fprintf(stderr, "log_level_parse called!\n"); abort(); } /* Generated stub for notify_log */ void notify_log(struct lightningd *ld UNNEEDED, const struct log_entry *l UNNEEDED) { fprintf(stderr, "notify_log called!\n"); abort(); } /* Generated stub for notify_warning */ void notify_warning(struct lightningd *ld UNNEEDED, struct log_entry *l UNNEEDED) { fprintf(stderr, "notify_warning called!\n"); abort(); } -/* Generated stub for param */ -bool param(struct command *cmd UNNEEDED, const char *buffer UNNEEDED, - const jsmntok_t params[] UNNEEDED, ...) -{ fprintf(stderr, "param called!\n"); abort(); } -/* Generated stub for pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace 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_node_id */ -void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "towire_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, char *argv[]) diff --git a/lightningd/test/run-log_filter.c b/lightningd/test/run-log_filter.c index e39f589f62ed..b125865439f9 100644 --- a/lightningd/test/run-log_filter.c +++ b/lightningd/test/run-log_filter.c @@ -15,69 +15,50 @@ void notify_log(struct lightningd *ld UNNEEDED, const struct log_entry *l UNNEED { } /* AUTOGENERATED MOCKS START */ -/* Generated stub for command_fail_badparam */ -struct command_result *command_fail_badparam(struct command *cmd UNNEEDED, - const char *paramname UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - const char *msg UNNEEDED) -{ fprintf(stderr, "command_fail_badparam called!\n"); abort(); } +/* Generated stub for command_check_done */ +struct command_result *command_check_done(struct command *cmd) + +{ fprintf(stderr, "command_check_done called!\n"); abort(); } +/* Generated stub for command_check_only */ +bool command_check_only(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_check_only called!\n"); abort(); } +/* Generated stub for command_deprecated_in_ok */ +bool command_deprecated_in_ok(struct command *cmd UNNEEDED, + const char *param UNNEEDED, + const char *depr_start UNNEEDED, + const char *depr_end UNNEEDED) +{ fprintf(stderr, "command_deprecated_in_ok called!\n"); abort(); } +/* Generated stub for command_dev_apis */ +bool command_dev_apis(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_dev_apis called!\n"); abort(); } +/* Generated stub for command_fail */ +struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_fail called!\n"); abort(); } +/* Generated stub for command_filter_ptr */ +struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_filter_ptr called!\n"); abort(); } +/* Generated stub for command_log */ +void command_log(struct command *cmd UNNEEDED, enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_log called!\n"); abort(); } /* Generated stub for command_param_failed */ struct command_result *command_param_failed(void) { fprintf(stderr, "command_param_failed called!\n"); abort(); } +/* Generated stub for command_set_usage */ +void command_set_usage(struct command *cmd UNNEEDED, const char *usage UNNEEDED) +{ fprintf(stderr, "command_set_usage called!\n"); abort(); } /* Generated stub for command_success */ struct command_result *command_success(struct command *cmd UNNEEDED, struct json_stream *response) { fprintf(stderr, "command_success 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(); } -/* Generated stub for fromwire_channel_id */ -bool 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 json_add_hex_talarr */ -void json_add_hex_talarr(struct json_stream *result UNNEEDED, - const char *fieldname UNNEEDED, - const tal_t *data UNNEEDED) -{ fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); } -/* Generated stub for json_add_node_id */ -void json_add_node_id(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct node_id *id UNNEEDED) -{ fprintf(stderr, "json_add_node_id called!\n"); abort(); } -/* Generated stub for json_add_num */ -void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - unsigned int value UNNEEDED) -{ fprintf(stderr, "json_add_num called!\n"); abort(); } -/* Generated stub for json_add_str_fmt */ -void json_add_str_fmt(struct json_stream *js UNNEEDED, - const char *fieldname UNNEEDED, - const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "json_add_str_fmt called!\n"); abort(); } -/* Generated stub for json_add_string */ -void json_add_string(struct json_stream *js UNNEEDED, - const char *fieldname UNNEEDED, - const char *str TAKES UNNEEDED) -{ fprintf(stderr, "json_add_string called!\n"); abort(); } -/* Generated stub for json_add_timestr */ -void json_add_timestr(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - struct timespec ts UNNEEDED) -{ fprintf(stderr, "json_add_timestr called!\n"); abort(); } -/* Generated stub for json_array_end */ -void json_array_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_array_end called!\n"); abort(); } -/* Generated stub for json_array_start */ -void json_array_start(struct json_stream *js UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_array_start called!\n"); abort(); } -/* Generated stub for json_object_end */ -void json_object_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_object_end called!\n"); abort(); } -/* Generated stub for json_object_start */ -void json_object_start(struct json_stream *ks UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_object_start called!\n"); abort(); } +/* Generated stub for command_usage_only */ +bool command_usage_only(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_usage_only called!\n"); abort(); } /* Generated stub for json_stream_log_suppress_for_cmd */ void json_stream_log_suppress_for_cmd(struct json_stream *js UNNEEDED, const struct command *cmd UNNEEDED) @@ -88,19 +69,6 @@ struct json_stream *json_stream_success(struct command *cmd UNNEEDED) /* Generated stub for notify_warning */ void notify_warning(struct lightningd *ld UNNEEDED, struct log_entry *l UNNEEDED) { fprintf(stderr, "notify_warning called!\n"); abort(); } -/* Generated stub for param */ -bool param(struct command *cmd UNNEEDED, const char *buffer UNNEEDED, - const jsmntok_t params[] UNNEEDED, ...) -{ fprintf(stderr, "param called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace 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(); } /* AUTOGENERATED MOCKS END */ static size_t num_written; diff --git a/lightningd/test/run-shuffle_fds.c b/lightningd/test/run-shuffle_fds.c index 90676083c0b7..6fce2f89900c 100644 --- a/lightningd/test/run-shuffle_fds.c +++ b/lightningd/test/run-shuffle_fds.c @@ -54,28 +54,6 @@ bool db_in_transaction(struct db *db UNNEEDED) /* Generated stub for fatal */ void fatal(const char *fmt UNNEEDED, ...) { fprintf(stderr, "fatal 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(); } -/* Generated stub for fromwire_channel_id */ -bool 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_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 fromwire_status_fail */ -bool fromwire_status_fail(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, enum status_failreason *failreason UNNEEDED, wirestring **desc UNNEEDED) -{ fprintf(stderr, "fromwire_status_fail called!\n"); abort(); } -/* Generated stub for fromwire_status_peer_billboard */ -bool fromwire_status_peer_billboard(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, bool *perm UNNEEDED, wirestring **happenings UNNEEDED) -{ fprintf(stderr, "fromwire_status_peer_billboard called!\n"); abort(); } -/* Generated stub for fromwire_status_peer_error */ -bool fromwire_status_peer_error(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, bool *disconnect UNNEEDED, wirestring **desc UNNEEDED, bool *warning UNNEEDED, u8 **error_for_them UNNEEDED) -{ fprintf(stderr, "fromwire_status_peer_error called!\n"); abort(); } -/* Generated stub for fromwire_status_version */ -bool fromwire_status_version(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, wirestring **version UNNEEDED) -{ fprintf(stderr, "fromwire_status_version called!\n"); abort(); } /* Generated stub for log_ */ void log_(struct logger *logger UNNEEDED, enum log_level level UNNEEDED, const struct node_id *node_id UNNEEDED, @@ -105,27 +83,9 @@ struct logger *new_logger(const tal_t *ctx UNNEEDED, struct log_book *record UNN /* Generated stub for new_peer_fd_arr */ struct peer_fd *new_peer_fd_arr(const tal_t *ctx UNNEEDED, const int *fd UNNEEDED) { fprintf(stderr, "new_peer_fd_arr called!\n"); abort(); } -/* Generated stub for pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); } -/* Generated stub for send_backtrace */ -void send_backtrace(const char *why UNNEEDED) -{ fprintf(stderr, "send_backtrace called!\n"); abort(); } /* Generated stub for subdaemon_path */ const char *subdaemon_path(const tal_t *ctx UNNEEDED, const struct lightningd *ld UNNEEDED, const char *name UNNEEDED) { fprintf(stderr, "subdaemon_path 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_node_id */ -void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "towire_node_id called!\n"); abort(); } -/* Generated stub for version */ -const char *version(void) -{ fprintf(stderr, "version called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ static void run_test_(int fd0, ...) diff --git a/onchaind/Makefile b/onchaind/Makefile index 8ef57d9ba6cd..b64cd0dc5640 100644 --- a/onchaind/Makefile +++ b/onchaind/Makefile @@ -29,43 +29,6 @@ LIGHTNINGD_CONTROL_OBJS += \ onchaind/onchaind_wiregen.o \ onchaind/onchaind_wire.o -# Common source we use. -ONCHAIND_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/bigsize.o \ - common/bip32.o \ - common/coin_mvt.o \ - common/channel_id.o \ - common/daemon.o \ - common/daemon_conn.o \ - common/derive_basepoints.o \ - common/status_wiregen.o \ - common/htlc_tx.o \ - common/htlc_wire.o \ - common/initial_commit_tx.o \ - common/keyset.o \ - common/key_derive.o \ - common/memleak.o \ - common/msg_queue.o \ - common/node_id.o \ - common/onionreply.o \ - common/peer_billboard.o \ - common/permute_tx.o \ - common/psbt_keypath.o \ - common/psbt_open.o \ - common/pseudorand.o \ - common/setup.o \ - common/status.o \ - common/status_wire.o \ - common/subdaemon.o \ - common/utils.o \ - common/utxo.o \ - common/version.o \ - common/wallet.o \ - common/wireaddr.o - -lightningd/lightning_onchaind: $(ONCHAIND_OBJS) $(WIRE_ONION_OBJS) $(ONCHAIND_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(HSMD_CLIENT_OBJS) +lightningd/lightning_onchaind: $(ONCHAIND_OBJS) $(HSMD_CLIENT_OBJS) libcommon.a include onchaind/test/Makefile diff --git a/onchaind/onchaind.c b/onchaind/onchaind.c index 0fbc8666fde0..5f2ad78dfd56 100644 --- a/onchaind/onchaind.c +++ b/onchaind/onchaind.c @@ -1,5 +1,4 @@ #include "config.h" -#include #include #include #include @@ -11,16 +10,14 @@ #include #include #include -#include #include -#include #include #include #include +#include #include #include #include -#include #include #include "onchain_types_names_gen.h" diff --git a/onchaind/onchaind_wire.csv b/onchaind/onchaind_wire.csv index f8f5e8eab86a..3c9c76bbaf5a 100644 --- a/onchaind/onchaind_wire.csv +++ b/onchaind/onchaind_wire.csv @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/onchaind/test/Makefile b/onchaind/test/Makefile index 6777cb13905d..b776ea1fd1a7 100644 --- a/onchaind/test/Makefile +++ b/onchaind/test/Makefile @@ -9,7 +9,13 @@ ONCHAIND_TEST_PROGRAMS := $(ONCHAIND_TEST_OBJS:.o=) ALL_C_SOURCES += $(ONCHAIND_TEST_SRC) ALL_TEST_PROGRAMS += $(ONCHAIND_TEST_PROGRAMS) -ONCHAIND_TEST_COMMON_OBJS := \ +# test/run-grind_feerate-bug uses its own htlc_timeout_tx() +$(filter-out onchaind/test/run-grind_feerate-bug,$(ONCHAIND_TEST_PROGRAMS)): libcommon.a + +onchaind/test/run-grind_feerate-bug: \ + $(BITCOIN_OBJS) \ + wire/towire.o \ + wire/fromwire.o \ common/amount.o \ common/autodata.o \ common/features.o \ @@ -18,25 +24,8 @@ ONCHAIND_TEST_COMMON_OBJS := \ common/setup.o \ common/utils.o -$(ONCHAIND_TEST_PROGRAMS): $(ONCHAIND_TEST_COMMON_OBJS) $(BITCOIN_OBJS) - -# This needs many more objs: -onchaind/test/run-onchainstress: \ - common/htlc_tx.o \ - common/derive_basepoints.o \ - common/daemon.o \ - common/htlc_wire.o \ - common/initial_commit_tx.o \ - common/key_derive.o \ - common/keyset.o \ - common/permute_tx.o \ - common/subdaemon.o \ - common/wallet.o \ - wire/towire.o \ - wire/fromwire.o - # Test objects depend on ../ src and headers. -$(ONCHAIND_TEST_OBJS): $(ONCHAIND_HEADERS) $(ONCHAIND_SRC) +$(ONCHAIND_TEST_OBJS): $(ONCHAIND_HEADERS) $(ONCHAIND_SRC) onchaind/test/Makefile onchaind-tests: $(ONCHAIND_TEST_PROGRAMS:%=unittest/%) diff --git a/onchaind/test/run-grind_feerate-bug.c b/onchaind/test/run-grind_feerate-bug.c index ff5ab45ef02a..ba71992cc5e8 100644 --- a/onchaind/test/run-grind_feerate-bug.c +++ b/onchaind/test/run-grind_feerate-bug.c @@ -12,8 +12,6 @@ int test_main(int argc, char *argv[]); #include "../onchaind.c" #undef main #include "../onchaind_wiregen.c" -#include "wire/fromwire.c" -#include "wire/towire.c" /* AUTOGENERATED MOCKS START */ /* Generated stub for commit_number_obscurer */ diff --git a/onchaind/test/run-grind_feerate.c b/onchaind/test/run-grind_feerate.c index e413f100d043..759331375fa8 100644 --- a/onchaind/test/run-grind_feerate.c +++ b/onchaind/test/run-grind_feerate.c @@ -15,34 +15,6 @@ int main(int argc, char *argv[]); #undef main /* AUTOGENERATED MOCKS START */ -/* Generated stub for commit_number_obscurer */ -u64 commit_number_obscurer(const struct pubkey *opener_payment_basepoint UNNEEDED, - const struct pubkey *accepter_payment_basepoint UNNEEDED) -{ fprintf(stderr, "commit_number_obscurer called!\n"); abort(); } -/* Generated stub for daemon_shutdown */ -void daemon_shutdown(void) -{ fprintf(stderr, "daemon_shutdown called!\n"); abort(); } -/* Generated stub for derive_keyset */ -bool derive_keyset(const struct pubkey *per_commitment_point UNNEEDED, - const struct basepoints *self UNNEEDED, - const struct basepoints *other UNNEEDED, - bool option_static_remotekey UNNEEDED, - struct keyset *keyset UNNEEDED) -{ fprintf(stderr, "derive_keyset called!\n"); abort(); } -/* Generated stub for dump_memleak_ */ -bool dump_memleak_(struct htable *memtable UNNEEDED, - void (*print)(void *arg UNNEEDED, const char *fmt UNNEEDED, ...) UNNEEDED, - void *arg UNNEEDED) -{ fprintf(stderr, "dump_memleak_ called!\n"); abort(); } -/* Generated stub for fromwire */ -const u8 *fromwire(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, void *copy UNNEEDED, size_t n UNNEEDED) -{ fprintf(stderr, "fromwire called!\n"); abort(); } -/* Generated stub for fromwire_bool */ -bool fromwire_bool(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_bool called!\n"); abort(); } -/* Generated stub for fromwire_fail */ -void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_fail called!\n"); abort(); } /* Generated stub for fromwire_hsmd_get_per_commitment_point_reply */ bool fromwire_hsmd_get_per_commitment_point_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct pubkey *per_commitment_point UNNEEDED, struct secret **old_commitment_secret UNNEEDED) { fprintf(stderr, "fromwire_hsmd_get_per_commitment_point_reply called!\n"); abort(); } @@ -67,198 +39,9 @@ bool fromwire_onchaind_spend_created(const tal_t *ctx UNNEEDED, const void *p UN /* Generated stub for fromwire_onchaind_spent */ bool fromwire_onchaind_spent(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct tx_parts **tx UNNEEDED, u32 *input_num UNNEEDED, u32 *blockheight UNNEEDED) { fprintf(stderr, "fromwire_onchaind_spent called!\n"); abort(); } -/* Generated stub for fromwire_peektype */ -int fromwire_peektype(const u8 *cursor UNNEEDED) -{ fprintf(stderr, "fromwire_peektype called!\n"); abort(); } -/* Generated stub for fromwire_secp256k1_ecdsa_signature */ -void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, - secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "fromwire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for fromwire_sha256 */ -void fromwire_sha256(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "fromwire_sha256 called!\n"); abort(); } -/* Generated stub for fromwire_tal_arrn */ -u8 *fromwire_tal_arrn(const tal_t *ctx UNNEEDED, - const u8 **cursor UNNEEDED, size_t *max UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_tal_arrn called!\n"); abort(); } -/* Generated stub for fromwire_u16 */ -u16 fromwire_u16(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u16 called!\n"); abort(); } -/* Generated stub for fromwire_u32 */ -u32 fromwire_u32(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u32 called!\n"); abort(); } -/* Generated stub for fromwire_u64 */ -u64 fromwire_u64(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u64 called!\n"); abort(); } -/* Generated stub for fromwire_u8 */ -u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_u8 called!\n"); abort(); } -/* Generated stub for fromwire_u8_array */ -void fromwire_u8_array(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "fromwire_u8_array called!\n"); abort(); } -/* Generated stub for htlc_offered_wscript */ -u8 *htlc_offered_wscript(const tal_t *ctx UNNEEDED, - const struct ripemd160 *ripemd UNNEEDED, - const struct keyset *keyset UNNEEDED, - bool option_anchor_outputs UNNEEDED, - bool option_anchors_zero_fee_htlc_tx UNNEEDED) -{ fprintf(stderr, "htlc_offered_wscript called!\n"); abort(); } -/* Generated stub for htlc_received_wscript */ -u8 *htlc_received_wscript(const tal_t *ctx UNNEEDED, - const struct ripemd160 *ripemd UNNEEDED, - const struct abs_locktime *expiry UNNEEDED, - const struct keyset *keyset UNNEEDED, - bool option_anchor_outputs UNNEEDED, - bool option_anchors_zero_fee_htlc_tx UNNEEDED) -{ fprintf(stderr, "htlc_received_wscript called!\n"); abort(); } -/* Generated stub for htlc_success_tx */ -struct bitcoin_tx *htlc_success_tx(const tal_t *ctx UNNEEDED, - const struct chainparams *chainparams UNNEEDED, - const struct bitcoin_outpoint *commit UNNEEDED, - const u8 *commit_wscript UNNEEDED, - struct amount_msat htlc_msatoshi UNNEEDED, - u16 to_self_delay UNNEEDED, - u32 feerate_per_kw UNNEEDED, - const struct keyset *keyset UNNEEDED, - bool option_anchor_outputs UNNEEDED, - bool option_anchors_zero_fee_htlc_tx UNNEEDED) -{ fprintf(stderr, "htlc_success_tx called!\n"); abort(); } -/* Generated stub for htlc_timeout_tx */ -struct bitcoin_tx *htlc_timeout_tx(const tal_t *ctx UNNEEDED, - const struct chainparams *chainparams UNNEEDED, - const struct bitcoin_outpoint *commit UNNEEDED, - const u8 *commit_wscript UNNEEDED, - struct amount_msat htlc_msatoshi UNNEEDED, - u32 cltv_expiry UNNEEDED, - u16 to_self_delay UNNEEDED, - u32 feerate_per_kw UNNEEDED, - const struct keyset *keyset UNNEEDED, - bool option_anchor_outputs UNNEEDED, - bool option_anchors_zero_fee_htlc_tx UNNEEDED) -{ fprintf(stderr, "htlc_timeout_tx called!\n"); abort(); } -/* Generated stub for master_badmsg */ -void master_badmsg(u32 type_expected UNNEEDED, const u8 *msg) -{ fprintf(stderr, "master_badmsg called!\n"); abort(); } -/* Generated stub for memleak_ptr */ -bool memleak_ptr(struct htable *memtable UNNEEDED, const void *p UNNEEDED) -{ fprintf(stderr, "memleak_ptr called!\n"); abort(); } -/* Generated stub for memleak_scan_obj */ -void memleak_scan_obj(struct htable *memtable UNNEEDED, const void *obj UNNEEDED) -{ fprintf(stderr, "memleak_scan_obj called!\n"); abort(); } -/* Generated stub for memleak_start */ -struct htable *memleak_start(const tal_t *ctx UNNEEDED) -{ fprintf(stderr, "memleak_start called!\n"); abort(); } -/* Generated stub for memleak_status_broken */ -void memleak_status_broken(void *unused UNNEEDED, const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "memleak_status_broken called!\n"); abort(); } -/* Generated stub for mk_mvt_tags_ */ -struct mvt_tags mk_mvt_tags_(enum mvt_tag tag UNNEEDED, ...) -{ fprintf(stderr, "mk_mvt_tags_ called!\n"); abort(); } -/* Generated stub for new_coin_channel_close */ -struct chain_coin_mvt *new_coin_channel_close(const tal_t *ctx UNNEEDED, - const struct channel *channel UNNEEDED, - const char *alt_account UNNEEDED, - const struct bitcoin_txid *txid UNNEEDED, - const struct bitcoin_outpoint *out UNNEEDED, - u32 blockheight UNNEEDED, - const struct amount_msat amount UNNEEDED, - const struct amount_sat output_val UNNEEDED, - u32 output_count UNNEEDED, - bool is_splice) - -{ fprintf(stderr, "new_coin_channel_close called!\n"); abort(); } -/* Generated stub for new_coin_external_deposit */ -struct chain_coin_mvt *new_coin_external_deposit(const tal_t *ctx UNNEEDED, - const struct bitcoin_outpoint *outpoint UNNEEDED, - u32 blockheight UNNEEDED, - struct amount_sat amount UNNEEDED, - struct mvt_tags tags) - -{ fprintf(stderr, "new_coin_external_deposit called!\n"); abort(); } -/* Generated stub for new_coin_external_spend */ -struct chain_coin_mvt *new_coin_external_spend(const tal_t *ctx UNNEEDED, - const struct bitcoin_outpoint *outpoint UNNEEDED, - const struct bitcoin_txid *txid UNNEEDED, - u32 blockheight UNNEEDED, - struct amount_sat amount UNNEEDED, - struct mvt_tags tags) - -{ fprintf(stderr, "new_coin_external_spend called!\n"); abort(); } -/* Generated stub for new_onchain_htlc_deposit */ -struct chain_coin_mvt *new_onchain_htlc_deposit(const tal_t *ctx UNNEEDED, - const struct bitcoin_outpoint *outpoint UNNEEDED, - u32 blockheight UNNEEDED, - struct amount_sat amount UNNEEDED, - const struct sha256 *payment_hash) - -{ fprintf(stderr, "new_onchain_htlc_deposit called!\n"); abort(); } -/* Generated stub for new_onchain_htlc_withdraw */ -struct chain_coin_mvt *new_onchain_htlc_withdraw(const tal_t *ctx UNNEEDED, - const struct bitcoin_outpoint *outpoint UNNEEDED, - u32 blockheight UNNEEDED, - struct amount_sat amount UNNEEDED, - const struct sha256 *payment_hash) - -{ fprintf(stderr, "new_onchain_htlc_withdraw called!\n"); abort(); } -/* Generated stub for new_onchaind_deposit */ -struct chain_coin_mvt *new_onchaind_deposit(const tal_t *ctx UNNEEDED, - const struct bitcoin_outpoint *outpoint UNNEEDED, - u32 blockheight UNNEEDED, - struct amount_sat amount UNNEEDED, - struct mvt_tags tags) - -{ fprintf(stderr, "new_onchaind_deposit called!\n"); abort(); } -/* Generated stub for new_onchaind_withdraw */ -struct chain_coin_mvt *new_onchaind_withdraw(const tal_t *ctx UNNEEDED, - const struct bitcoin_outpoint *outpoint UNNEEDED, - const struct bitcoin_txid *spend_txid UNNEEDED, - u32 blockheight UNNEEDED, - struct amount_sat amount UNNEEDED, - struct mvt_tags tags) - -{ fprintf(stderr, "new_onchaind_withdraw called!\n"); abort(); } -/* Generated stub for notleak_ */ -void *notleak_(void *ptr UNNEEDED, bool plus_children UNNEEDED) -{ fprintf(stderr, "notleak_ called!\n"); abort(); } /* Generated stub for onchaind_wire_name */ const char *onchaind_wire_name(int e UNNEEDED) { fprintf(stderr, "onchaind_wire_name called!\n"); abort(); } -/* Generated stub for peer_billboard */ -void peer_billboard(bool perm UNNEEDED, const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "peer_billboard called!\n"); abort(); } -/* Generated stub for shachain_get_secret */ -bool shachain_get_secret(const struct shachain *shachain UNNEEDED, - u64 commit_num UNNEEDED, - struct secret *preimage UNNEEDED) -{ fprintf(stderr, "shachain_get_secret called!\n"); abort(); } -/* Generated stub for status_failed */ -void status_failed(enum status_failreason code UNNEEDED, - const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "status_failed called!\n"); abort(); } -/* Generated stub for status_fmt */ -void status_fmt(enum log_level level UNNEEDED, - const struct node_id *peer UNNEEDED, - const char *fmt UNNEEDED, ...) - -{ fprintf(stderr, "status_fmt called!\n"); abort(); } -/* Generated stub for status_setup_sync */ -void status_setup_sync(int fd UNNEEDED) -{ fprintf(stderr, "status_setup_sync called!\n"); abort(); } -/* Generated stub for subdaemon_setup */ -bool subdaemon_setup(int argc UNNEEDED, char *argv[]) -{ fprintf(stderr, "subdaemon_setup called!\n"); abort(); } -/* Generated stub for to_self_wscript */ -u8 *to_self_wscript(const tal_t *ctx UNNEEDED, - u16 to_self_delay UNNEEDED, - u32 csv UNNEEDED, - const struct keyset *keyset UNNEEDED) -{ fprintf(stderr, "to_self_wscript called!\n"); abort(); } -/* Generated stub for towire */ -void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "towire called!\n"); abort(); } -/* Generated stub for towire_bool */ -void towire_bool(u8 **pptr UNNEEDED, bool v UNNEEDED) -{ fprintf(stderr, "towire_bool called!\n"); abort(); } /* Generated stub for towire_hsmd_get_per_commitment_point */ u8 *towire_hsmd_get_per_commitment_point(const tal_t *ctx UNNEEDED, u64 n UNNEEDED) { fprintf(stderr, "towire_hsmd_get_per_commitment_point called!\n"); abort(); } @@ -316,34 +99,6 @@ u8 *towire_onchaind_spend_to_us(const tal_t *ctx UNNEEDED, const struct bitcoin_ /* Generated stub for towire_onchaind_spent_reply */ u8 *towire_onchaind_spent_reply(const tal_t *ctx UNNEEDED, bool interested UNNEEDED) { fprintf(stderr, "towire_onchaind_spent_reply called!\n"); abort(); } -/* Generated stub for towire_secp256k1_ecdsa_signature */ -void towire_secp256k1_ecdsa_signature(u8 **pptr UNNEEDED, - const secp256k1_ecdsa_signature *signature UNNEEDED) -{ fprintf(stderr, "towire_secp256k1_ecdsa_signature called!\n"); abort(); } -/* Generated stub for towire_sha256 */ -void towire_sha256(u8 **pptr UNNEEDED, const struct sha256 *sha256 UNNEEDED) -{ fprintf(stderr, "towire_sha256 called!\n"); abort(); } -/* Generated stub for towire_u16 */ -void towire_u16(u8 **pptr UNNEEDED, u16 v UNNEEDED) -{ fprintf(stderr, "towire_u16 called!\n"); abort(); } -/* Generated stub for towire_u32 */ -void towire_u32(u8 **pptr UNNEEDED, u32 v UNNEEDED) -{ fprintf(stderr, "towire_u32 called!\n"); abort(); } -/* Generated stub for towire_u64 */ -void towire_u64(u8 **pptr UNNEEDED, u64 v UNNEEDED) -{ fprintf(stderr, "towire_u64 called!\n"); abort(); } -/* Generated stub for towire_u8 */ -void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED) -{ fprintf(stderr, "towire_u8 called!\n"); abort(); } -/* Generated stub for towire_u8_array */ -void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED) -{ fprintf(stderr, "towire_u8_array called!\n"); abort(); } -/* Generated stub for wire_sync_read */ -u8 *wire_sync_read(const tal_t *ctx UNNEEDED, int fd UNNEEDED) -{ fprintf(stderr, "wire_sync_read called!\n"); abort(); } -/* Generated stub for wire_sync_write */ -bool wire_sync_write(int fd UNNEEDED, const void *msg TAKES UNNEEDED) -{ fprintf(stderr, "wire_sync_write called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, char *argv[]) diff --git a/openingd/Makefile b/openingd/Makefile index 57dc84ee4177..b5a1c29f8870 100644 --- a/openingd/Makefile +++ b/openingd/Makefile @@ -29,63 +29,8 @@ ALL_PROGRAMS += lightningd/lightning_openingd lightningd/lightning_dualopend LIGHTNINGD_CONTROL_HEADERS += openingd/openingd_wiregen.h openingd/dualopend_wiregen.h LIGHTNINGD_CONTROL_OBJS += openingd/openingd_wiregen.o openingd/dualopend_wiregen.o -# Common source we use. -OPENINGD_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/bigsize.o \ - common/billboard.o \ - common/bip32.o \ - common/blockheight_states.o \ - common/channel_config.o \ - common/channel_id.o \ - common/channel_type.o \ - common/cryptomsg.o \ - common/daemon.o \ - common/daemon_conn.o \ - common/derive_basepoints.o \ - common/features.o \ - common/fee_states.o \ - common/gossip_store.o \ - common/htlc_state.o \ - common/htlc_wire.o \ - common/initial_channel.o \ - common/initial_commit_tx.o \ - common/key_derive.o \ - common/keyset.o \ - common/lease_rates.o \ - common/memleak.o \ - common/msg_queue.o \ - common/node_id.o \ - common/onionreply.o \ - common/peer_billboard.o \ - common/peer_failed.o \ - common/peer_io.o \ - common/peer_status_wiregen.o \ - common/penalty_base.o \ - common/per_peer_state.o \ - common/permute_tx.o \ - common/ping.o \ - common/psbt_internal.o \ - common/psbt_open.o \ - common/pseudorand.o \ - common/read_peer_msg.o \ - common/setup.o \ - common/shutdown_scriptpubkey.o \ - common/status.o \ - common/status_wire.o \ - common/status_wiregen.o \ - common/subdaemon.o \ - common/tx_roles.o \ - common/utils.o \ - common/utxo.o \ - common/version.o \ - common/wire_error.o \ - common/wireaddr.o +lightningd/lightning_openingd: $(OPENINGD_OBJS) $(HSMD_CLIENT_OBJS) libcommon.a -lightningd/lightning_openingd: $(OPENINGD_OBJS) $(OPENINGD_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(HSMD_CLIENT_OBJS) - -lightningd/lightning_dualopend: $(DUALOPEND_OBJS) $(OPENINGD_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(HSMD_CLIENT_OBJS) +lightningd/lightning_dualopend: $(DUALOPEND_OBJS) $(HSMD_CLIENT_OBJS) libcommon.a -include openingd/test/Makefile diff --git a/openingd/common.c b/openingd/common.c index 78c72f908ba5..d57bd835d211 100644 --- a/openingd/common.c +++ b/openingd/common.c @@ -1,7 +1,6 @@ #include "config.h" #include #include -#include #include #include #include diff --git a/openingd/common.h b/openingd/common.h index aab8bd848427..346449485747 100644 --- a/openingd/common.h +++ b/openingd/common.h @@ -2,6 +2,7 @@ #define LIGHTNING_OPENINGD_COMMON_H #include "config.h" +#include struct amount_sat; struct bitcoin_tx; diff --git a/openingd/dualopend.c b/openingd/dualopend.c index 8e902fa59670..9ac43d87a861 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -19,15 +19,12 @@ #include #include #include -#include -#include #include #include #include #include #include #include -#include #include #include #include @@ -38,9 +35,11 @@ #include #include #include +#include #include #include #include +#include #include /* stdin == lightningd, 3 == peer, 4 = hsmd */ diff --git a/openingd/dualopend_wire.csv b/openingd/dualopend_wire.csv index 34841392ffa7..d6b157495437 100644 --- a/openingd/dualopend_wire.csv +++ b/openingd/dualopend_wire.csv @@ -1,5 +1,6 @@ #include #include +#include #include #include #include diff --git a/openingd/openingd.c b/openingd/openingd.c index 23331faff725..7a86218b339d 100644 --- a/openingd/openingd.c +++ b/openingd/openingd.c @@ -12,9 +12,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -25,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/openingd/openingd_wire.csv b/openingd/openingd_wire.csv index c70de6cf01d2..f96c50b0037c 100644 --- a/openingd/openingd_wire.csv +++ b/openingd/openingd_wire.csv @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/plugins/Makefile b/plugins/Makefile index b1d5120b6f5c..8594cc44d3e6 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -23,8 +23,8 @@ PLUGIN_COMMANDO_OBJS := $(PLUGIN_COMMANDO_SRC:.c=.o) PLUGIN_KEYSEND_SRC := plugins/keysend.c PLUGIN_KEYSEND_OBJS := $(PLUGIN_KEYSEND_SRC:.c=.o) -PLUGIN_LIB_SRC := plugins/libplugin.c common/trace.c -PLUGIN_LIB_HEADER := plugins/libplugin.h common/trace.h +PLUGIN_LIB_SRC := plugins/libplugin.c +PLUGIN_LIB_HEADER := plugins/libplugin.h PLUGIN_LIB_OBJS := $(PLUGIN_LIB_SRC:.c=.o) PLUGIN_PAY_LIB_SRC := \ @@ -156,59 +156,6 @@ plugins/cln-bip353: $(RUST_TARGET_DIR)/cln-bip353 PLUGINS += plugins/cln-grpc plugins/clnrest plugins/cln-lsps-client plugins/cln-lsps-service plugins/wss-proxy plugins/cln-bip353 endif -PLUGIN_COMMON_OBJS := \ - bitcoin/base58.o \ - bitcoin/block.o \ - bitcoin/chainparams.o \ - bitcoin/feerate.o \ - bitcoin/preimage.o \ - bitcoin/privkey.o \ - bitcoin/psbt.o \ - bitcoin/pubkey.o \ - bitcoin/script.o \ - bitcoin/shadouble.o \ - bitcoin/short_channel_id.o \ - bitcoin/signature.o \ - bitcoin/tx.o \ - bitcoin/varint.o \ - common/addr.o \ - common/amount.o \ - common/autodata.o \ - common/coin_mvt.o \ - common/base32.o \ - common/bech32.o \ - common/bech32_util.o \ - common/bigsize.o \ - common/bolt11.o \ - common/channel_id.o \ - common/daemon.o \ - common/deprecation.o \ - common/features.o \ - common/hash_u5.o \ - common/json_command.o \ - common/json_param.o \ - common/json_parse.o \ - common/json_parse_simple.o \ - common/json_filter.o \ - common/json_stream.o \ - common/lease_rates.o \ - common/memleak.o \ - common/node_id.o \ - common/plugin.o \ - common/psbt_open.o \ - common/pseudorand.o \ - common/random_select.o \ - common/splice_script.o \ - common/setup.o \ - common/status_levels.o \ - common/utils.o \ - common/version.o \ - common/wireaddr.o \ - wire/fromwire.o \ - wire/peer_wiregen.o \ - wire/tlvstream.o \ - wire/towire.o - include plugins/askrene/Makefile include plugins/bkpr/Makefile include plugins/renepay/Makefile @@ -221,39 +168,39 @@ ALL_PROGRAMS += $(C_PLUGINS) PLUGIN_ALL_OBJS := $(PLUGIN_ALL_SRC:.c=.o) -# Make all plugins depend on all plugin headers, for simplicity. -$(PLUGIN_ALL_OBJS): $(PLUGIN_ALL_HEADER) +# Make all plugins depend on all plugin headers, for simplicity (and this file!) +$(PLUGIN_ALL_OBJS): $(PLUGIN_ALL_HEADER) plugins/Makefile -plugins/pay: $(PLUGIN_PAY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/gossmap.o common/fp16.o common/route.o common/dijkstra.o common/bolt12.o common/bolt12_merkle.o wire/bolt12_wiregen.o bitcoin/block.o common/blindedpay.o common/blindedpath.o common/hmac.o common/blinding.o common/onion_encode.o common/gossmods_listpeerchannels.o common/sciddir_or_pubkey.o wire/onion_wiregen.o +plugins/pay: $(PLUGIN_PAY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) libcommon.a -plugins/autoclean: $(PLUGIN_AUTOCLEAN_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) +plugins/autoclean: $(PLUGIN_AUTOCLEAN_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a -plugins/chanbackup: $(PLUGIN_chanbackup_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/scb_wiregen.o wire/channel_type_wiregen.o common/htlc_wire.o common/onionreply.o common/derive_basepoints.o +plugins/chanbackup: $(PLUGIN_chanbackup_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a -plugins/commando: $(PLUGIN_COMMANDO_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) +plugins/commando: $(PLUGIN_COMMANDO_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a # 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/sciddir_or_pubkey.o common/fp16.o wire/peer_wiregen.o wire/channel_type_wiregen.o bitcoin/block.o bitcoin/preimage.o common/gossmods_listpeerchannels.o $(PLUGIN_TOPOLOGY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) +plugins/topology: $(PLUGIN_TOPOLOGY_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a -plugins/txprepare: $(PLUGIN_TXPREPARE_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) +plugins/txprepare: $(PLUGIN_TXPREPARE_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a -plugins/exposesecret: $(PLUGIN_EXPOSESECRET_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/hsm_encryption.o common/codex32.o +plugins/exposesecret: $(PLUGIN_EXPOSESECRET_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a -plugins/bcli: $(PLUGIN_BCLI_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) +plugins/bcli: $(PLUGIN_BCLI_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a -plugins/keysend: wire/tlvstream.o wire/onion_wiregen.o $(PLUGIN_KEYSEND_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/gossmap.o common/fp16.o common/route.o common/dijkstra.o common/blindedpay.o common/blindedpath.o common/hmac.o common/blinding.o common/onion_encode.o common/gossmods_listpeerchannels.o common/sciddir_or_pubkey.o -$(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER) +plugins/keysend: $(PLUGIN_KEYSEND_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) libcommon.a +$(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER) libcommon.a -plugins/spenderp: bitcoin/block.o bitcoin/preimage.o bitcoin/psbt.o common/psbt_open.o common/json_channel_type.o common/channel_type.o common/features.o wire/peer_wiregen.o $(PLUGIN_SPENDER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) +plugins/spenderp: $(PLUGIN_SPENDER_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a -plugins/offers: $(PLUGIN_OFFERS_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) common/addr.o common/bolt12.o common/bolt12_merkle.o common/bolt11_json.o common/iso4217.o $(WIRE_OBJS) $(WIRE_BOLT12_OBJS) bitcoin/block.o common/channel_id.o bitcoin/preimage.o common/blindedpath.o common/bolt12_id.o common/blinding.o common/hmac.o common/json_blinded_path.o common/gossmap.o common/fp16.o $(JSMN_OBJS) common/dijkstra.o common/route.o common/gossmods_listpeerchannels.o common/onion_message.o common/sphinx.o common/onionreply.o +plugins/offers: $(PLUGIN_OFFERS_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a -plugins/funder: bitcoin/psbt.o common/psbt_open.o $(PLUGIN_FUNDER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) +plugins/funder: $(PLUGIN_FUNDER_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a -plugins/recover: common/gossmap.o common/sciddir_or_pubkey.o common/fp16.o $(PLUGIN_RECOVER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) +plugins/recover: $(PLUGIN_RECOVER_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a -plugins/recklessrpc: $(PLUGIN_RECKLESSRPC_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) +plugins/recklessrpc: $(PLUGIN_RECKLESSRPC_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a # This covers all the low-level list RPCs which return simple arrays SQL_LISTRPCS := listchannels listforwards listhtlcs listinvoices listnodes listoffers listpeers listpeerchannels listclosedchannels listtransactions listsendpays listchainmoves listchannelmoves bkpr-listaccountevents bkpr-listincome @@ -284,7 +231,7 @@ plugins/sql-schema_gen.h: $(SQL_SCHEMA_PARTS) ) plugins/sql.o: plugins/sql-schema_gen.h -plugins/sql: $(PLUGIN_SQL_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/gossip_store.o gossipd/gossip_store_wiregen.o +plugins/sql: $(PLUGIN_SQL_OBJS) $(PLUGIN_LIB_OBJS) gossipd/gossip_store_wiregen.o libcommon.a # Generated from PLUGINS definition in plugins/Makefile ALL_C_HEADERS += plugins/list_of_builtin_plugins_gen.h diff --git a/plugins/askrene/Makefile b/plugins/askrene/Makefile index a34442df4b27..029234c53370 100644 --- a/plugins/askrene/Makefile +++ b/plugins/askrene/Makefile @@ -26,11 +26,11 @@ PLUGIN_ASKRENE_HEADER := \ PLUGIN_ASKRENE_OBJS := $(PLUGIN_ASKRENE_SRC:.c=.o) -$(PLUGIN_ASKRENE_OBJS): $(PLUGIN_ASKRENE_HEADER) +$(PLUGIN_ASKRENE_OBJS): $(PLUGIN_ASKRENE_HEADER) plugins/askrene/Makefile PLUGIN_ALL_SRC += $(PLUGIN_ASKRENE_SRC) PLUGIN_ALL_HEADER += $(PLUGIN_ASKRENE_HEADER) -plugins/cln-askrene: $(PLUGIN_ASKRENE_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) bitcoin/chainparams.o common/gossmap.o common/sciddir_or_pubkey.o common/gossmods_listpeerchannels.o common/fp16.o common/dijkstra.o common/bolt12.o common/bolt12_merkle.o wire/bolt12_wiregen.o wire/onion_wiregen.o common/route.o +plugins/cln-askrene: $(PLUGIN_ASKRENE_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a include plugins/askrene/test/Makefile diff --git a/plugins/askrene/askrene.c b/plugins/askrene/askrene.c index 9664d2487d7f..fff49c0544e6 100644 --- a/plugins/askrene/askrene.c +++ b/plugins/askrene/askrene.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/askrene/mcf.c b/plugins/askrene/mcf.c index 4614fb49c5d9..8d69511eb6b6 100644 --- a/plugins/askrene/mcf.c +++ b/plugins/askrene/mcf.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/askrene/reserve.c b/plugins/askrene/reserve.c index abec9372dfc7..59457fc24687 100644 --- a/plugins/askrene/reserve.c +++ b/plugins/askrene/reserve.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include diff --git a/plugins/askrene/test/Makefile b/plugins/askrene/test/Makefile index 88ee0b88a2fd..575947548a2e 100644 --- a/plugins/askrene/test/Makefile +++ b/plugins/askrene/test/Makefile @@ -6,15 +6,13 @@ PLUGIN_ASKRENE_TEST_PROGRAMS := $(PLUGIN_ASKRENE_TEST_OBJS:.o=) ALL_C_SOURCES += $(PLUGIN_ASKRENE_TEST_SRC) ALL_TEST_PROGRAMS += $(PLUGIN_ASKRENE_TEST_PROGRAMS) -$(PLUGIN_RENEPAY_TEST_OBJS): $(PLUGIN_ASKRENE_SRC) - -PLUGIN_ASKRENE_TEST_COMMON_OBJS := +$(PLUGIN_RENEPAY_TEST_OBJS): $(PLUGIN_ASKRENE_SRC) plugins/askrene/test/Makefile plugins/askrene/test/run-bfs plugins/askrene/test/run-dijkstra plugins/askrene/test/run-flow plugins/askrene/test/run-mcf plugins/askrene/test/run-mcf-large: \ plugins/askrene/priorityqueue.o \ plugins/askrene/graph.o -$(PLUGIN_ASKRENE_TEST_PROGRAMS): $(PLUGIN_ASKRENE_TEST_COMMON_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) +$(PLUGIN_ASKRENE_TEST_PROGRAMS): $(PLUGIN_LIB_OBJS) libcommon.a check-askrene: $(PLUGIN_ASKRENE_TEST_PROGRAMS:%=unittest/%) diff --git a/plugins/autoclean.c b/plugins/autoclean.c index bfd358c988c6..f1561252252e 100644 --- a/plugins/autoclean.c +++ b/plugins/autoclean.c @@ -1,11 +1,11 @@ #include "config.h" #include #include -#include #include #include #include #include +#include #include static u64 cycle_seconds = 3600; diff --git a/plugins/bcli.c b/plugins/bcli.c index fdd5a7c6e228..656df9ffad43 100644 --- a/plugins/bcli.c +++ b/plugins/bcli.c @@ -1,5 +1,4 @@ #include "config.h" -#include #include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include #include /* Bitcoind's web server has a default of 4 threads, with queue depth 16. diff --git a/plugins/bkpr/Makefile b/plugins/bkpr/Makefile index 943b8755f0b2..0647a546226d 100644 --- a/plugins/bkpr/Makefile +++ b/plugins/bkpr/Makefile @@ -40,7 +40,7 @@ PLUGIN_ALL_HEADER += $(BOOKKEEPER_HEADER) C_PLUGINS += plugins/bookkeeper PLUGINS += plugins/bookkeeper -plugins/bookkeeper: common/bolt12.o common/bolt12_merkle.o common/channel_type.o $(BOOKKEEPER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(WIRE_OBJS) $(WIRE_BOLT12_OBJS) +plugins/bookkeeper: $(BOOKKEEPER_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a maintainer-clean: clean clean: bkpr-maintainer-clean diff --git a/plugins/bkpr/bookkeeper.c b/plugins/bkpr/bookkeeper.c index 1312924de600..5889e1f75c46 100644 --- a/plugins/bkpr/bookkeeper.c +++ b/plugins/bkpr/bookkeeper.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/bkpr/rebalances.c b/plugins/bkpr/rebalances.c index 38bbdcd84289..91d9dd6f9aa3 100644 --- a/plugins/bkpr/rebalances.c +++ b/plugins/bkpr/rebalances.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/bkpr/test/Makefile b/plugins/bkpr/test/Makefile index 80fed1875c0a..c28bc00b7fbe 100644 --- a/plugins/bkpr/test/Makefile +++ b/plugins/bkpr/test/Makefile @@ -5,34 +5,7 @@ BOOKKEEPER_TEST_PROGRAMS := $(BOOKKEEPER_TEST_OBJS:.o=) ALL_C_SOURCES += $(BOOKKEEPER_TEST_SRC) ALL_TEST_PROGRAMS += $(BOOKKEEPER_TEST_PROGRAMS) -BOOKKEEPER_TEST_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/blockheight_states.o \ - common/channel_type.o \ - common/coin_mvt.o \ - common/features.o \ - common/json_parse.o \ - common/json_stream.o \ - common/json_parse_simple.o \ - common/key_derive.o \ - common/memleak.o \ - common/node_id.o \ - common/pseudorand.o \ - common/setup.o \ - common/trace.o \ - common/timeout.o \ - common/utils.o \ - common/version.o \ - db/bindings.o \ - db/db_sqlite3.o \ - db/exec.o \ - db/utils.o \ - wire/towire.o \ - wire/fromwire.o - -$(BOOKKEEPER_TEST_PROGRAMS): $(BITCOIN_OBJS) $(BOOKKEEPER_TEST_COMMON_OBJS) -$(BOOKKEEPER_TEST_OBJS): $(BOOKKEEPER_HEADER) $(BOOKKEEPER_SRC) $(BOOKKEEPER_TEST_COMMON_OBJS) +$(BOOKKEEPER_TEST_PROGRAMS): libcommon.a +$(BOOKKEEPER_TEST_OBJS): $(BOOKKEEPER_SRC) $(BOOKKEEPER_HEADER) plugins/bkpr/test/Makefile check-units: $(BOOKKEEPER_TEST_PROGRAMS:%=unittest/%) diff --git a/plugins/bkpr/test/run-recorder.c b/plugins/bkpr/test/run-recorder.c index da01849f1574..bc2177e72105 100644 --- a/plugins/bkpr/test/run-recorder.c +++ b/plugins/bkpr/test/run-recorder.c @@ -46,37 +46,25 @@ const char *chain_event_description(const struct bkpr *bkpr UNNEEDED, const char *channel_event_description(const struct bkpr *bkpr UNNEEDED, const struct channel_event *ce UNNEEDED) { fprintf(stderr, "channel_event_description called!\n"); abort(); } -/* Generated stub for command_fail_badparam */ -struct command_result *command_fail_badparam(struct command *cmd UNNEEDED, - const char *paramname UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - const char *msg UNNEEDED) -{ fprintf(stderr, "command_fail_badparam called!\n"); abort(); } +/* Generated stub for command_check_only */ +bool command_check_only(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_check_only called!\n"); abort(); } +/* Generated stub for command_dev_apis */ +bool command_dev_apis(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_dev_apis called!\n"); abort(); } +/* Generated stub for command_fail */ +struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_fail called!\n"); abort(); } /* Generated stub for command_filter_ptr */ struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED) { fprintf(stderr, "command_filter_ptr called!\n"); abort(); } -/* Generated stub for first_fee_state */ -enum htlc_state first_fee_state(enum side opener UNNEEDED) -{ fprintf(stderr, "first_fee_state called!\n"); abort(); } -/* Generated stub for fmt_channel_id */ -char *fmt_channel_id(const tal_t *ctx UNNEEDED, const struct channel_id *channel_id UNNEEDED) -{ fprintf(stderr, "fmt_channel_id called!\n"); abort(); } -/* 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_wireaddr */ -bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED) -{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); } -/* Generated stub for htlc_state_flags */ -int htlc_state_flags(enum htlc_state state UNNEEDED) -{ fprintf(stderr, "htlc_state_flags called!\n"); abort(); } -/* Generated stub for htlc_state_name */ -const char *htlc_state_name(enum htlc_state s UNNEEDED) -{ fprintf(stderr, "htlc_state_name called!\n"); abort(); } -/* Generated stub for last_fee_state */ -enum htlc_state last_fee_state(enum side opener UNNEEDED) -{ fprintf(stderr, "last_fee_state called!\n"); abort(); } +/* Generated stub for command_log */ +void command_log(struct command *cmd UNNEEDED, enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_log called!\n"); abort(); } /* Generated stub for plugin_err */ void plugin_err(struct plugin *p UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "plugin_err called!\n"); abort(); } diff --git a/plugins/bkpr/test/run-sql.c b/plugins/bkpr/test/run-sql.c index 8be5859adad7..28da98b7bf5a 100644 --- a/plugins/bkpr/test/run-sql.c +++ b/plugins/bkpr/test/run-sql.c @@ -12,69 +12,9 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for daemon_developer_mode */ -bool daemon_developer_mode(char *argv[]) -{ fprintf(stderr, "daemon_developer_mode called!\n"); abort(); } -/* Generated stub for daemon_setup */ -void daemon_setup(const char *argv0 UNNEEDED, - void (*backtrace_print)(const char *fmt UNNEEDED, ...) UNNEEDED, - void (*backtrace_exit)(void)) -{ fprintf(stderr, "daemon_setup called!\n"); abort(); } -/* Generated stub for deprecated_ok_ */ -bool deprecated_ok_(bool deprecated_apis UNNEEDED, - const char *feature UNNEEDED, - const char *start UNNEEDED, - const char *end UNNEEDED, - const char **begs UNNEEDED, - void (*complain)(const char *feat UNNEEDED, bool allowing UNNEEDED, void *) UNNEEDED, - void *cbarg UNNEEDED) -{ fprintf(stderr, "deprecated_ok_ called!\n"); abort(); } /* Generated stub for find_blockheight */ u32 find_blockheight(const struct bkpr *bkpr UNNEEDED, const struct bitcoin_txid *txid UNNEEDED) { fprintf(stderr, "find_blockheight called!\n"); abort(); } -/* Generated stub for first_fee_state */ -enum htlc_state first_fee_state(enum side opener UNNEEDED) -{ fprintf(stderr, "first_fee_state called!\n"); abort(); } -/* Generated stub for fmt_channel_id */ -char *fmt_channel_id(const tal_t *ctx UNNEEDED, const struct channel_id *channel_id UNNEEDED) -{ fprintf(stderr, "fmt_channel_id called!\n"); abort(); } -/* 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_wireaddr */ -bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED) -{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); } -/* Generated stub for htlc_state_flags */ -int htlc_state_flags(enum htlc_state state UNNEEDED) -{ fprintf(stderr, "htlc_state_flags called!\n"); abort(); } -/* Generated stub for htlc_state_name */ -const char *htlc_state_name(enum htlc_state s UNNEEDED) -{ fprintf(stderr, "htlc_state_name called!\n"); abort(); } -/* Generated stub for is_asterix_notification */ -bool is_asterix_notification(const char *notification_name UNNEEDED, - const char *subscriptions UNNEEDED) -{ fprintf(stderr, "is_asterix_notification called!\n"); abort(); } -/* Generated stub for json_filter_down */ -bool json_filter_down(struct json_filter **filter UNNEEDED, const char *member UNNEEDED) -{ fprintf(stderr, "json_filter_down called!\n"); abort(); } -/* Generated stub for json_filter_finished */ -bool json_filter_finished(const struct json_filter *filter UNNEEDED) -{ fprintf(stderr, "json_filter_finished called!\n"); abort(); } -/* Generated stub for json_filter_misused */ -const char *json_filter_misused(const tal_t *ctx UNNEEDED, const struct json_filter *f UNNEEDED) -{ fprintf(stderr, "json_filter_misused called!\n"); abort(); } -/* Generated stub for json_filter_ok */ -bool json_filter_ok(const struct json_filter *filter UNNEEDED, const char *member UNNEEDED) -{ fprintf(stderr, "json_filter_ok called!\n"); abort(); } -/* Generated stub for json_filter_up */ -bool json_filter_up(struct json_filter **filter UNNEEDED) -{ fprintf(stderr, "json_filter_up called!\n"); abort(); } -/* Generated stub for last_fee_state */ -enum htlc_state last_fee_state(enum side opener UNNEEDED) -{ fprintf(stderr, "last_fee_state called!\n"); abort(); } -/* Generated stub for log_level_name */ -const char *log_level_name(enum log_level level UNNEEDED) -{ fprintf(stderr, "log_level_name called!\n"); abort(); } /* Generated stub for new_channel_event */ struct channel_event *new_channel_event(const tal_t *ctx UNNEEDED, const char *tag UNNEEDED, @@ -85,17 +25,6 @@ struct channel_event *new_channel_event(const tal_t *ctx UNNEEDED, u32 part_id UNNEEDED, u64 timestamp UNNEEDED) { fprintf(stderr, "new_channel_event called!\n"); abort(); } -/* Generated stub for param_check */ -bool param_check(struct command *cmd UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t tokens[] UNNEEDED, ...) -{ fprintf(stderr, "param_check called!\n"); abort(); } -/* Generated stub for parse_filter */ -struct command_result *parse_filter(struct command *cmd UNNEEDED, - const char *name UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED) -{ fprintf(stderr, "parse_filter called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, char *argv[]) diff --git a/plugins/chanbackup.c b/plugins/chanbackup.c index 11091edd92c4..de298ec30f44 100644 --- a/plugins/chanbackup.c +++ b/plugins/chanbackup.c @@ -1,21 +1,18 @@ #include "config.h" #include #include -#include #include #include #include #include #include -#include -#include -#include #include #include #include #include #include #include +#include #include #include #include diff --git a/plugins/channel_hint.c b/plugins/channel_hint.c index 1db37791ea0a..cf431cb85d94 100644 --- a/plugins/channel_hint.c +++ b/plugins/channel_hint.c @@ -1,4 +1,5 @@ #include "config.h" +#include #include #include diff --git a/plugins/channel_hint.h b/plugins/channel_hint.h index 200458f82213..db94c5b3ecff 100644 --- a/plugins/channel_hint.h +++ b/plugins/channel_hint.h @@ -2,11 +2,6 @@ #define LIGHTNING_PLUGINS_CHANNEL_HINT_H #include "config.h" -#include -#include -#include -#include -#include #include /* Information about channels we inferred from a) looking at our channels, and diff --git a/plugins/commando.c b/plugins/commando.c index 608e8dfe9284..f5022be8dd14 100644 --- a/plugins/commando.c +++ b/plugins/commando.c @@ -1,18 +1,14 @@ #include "config.h" #include #include -#include -#include -#include #include #include #include #include -#include #include #include #include -#include +#include #include /* We (as your local commando command) detected an error. */ diff --git a/plugins/establish_onion_path.c b/plugins/establish_onion_path.c index bfef89ceae15..f3213bdc8d50 100644 --- a/plugins/establish_onion_path.c +++ b/plugins/establish_onion_path.c @@ -1,8 +1,7 @@ #include "config.h" -#include #include +#include #include -#include #include #include #include diff --git a/plugins/establish_onion_path.h b/plugins/establish_onion_path.h index bb9a055c46af..19411fef6884 100644 --- a/plugins/establish_onion_path.h +++ b/plugins/establish_onion_path.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_PLUGINS_ESTABLISH_ONION_PATH_H #define LIGHTNING_PLUGINS_ESTABLISH_ONION_PATH_H #include "config.h" -#include #include struct gossmap; diff --git a/plugins/exposesecret.c b/plugins/exposesecret.c index ea50fa03ce01..ed944cd6de0d 100644 --- a/plugins/exposesecret.c +++ b/plugins/exposesecret.c @@ -1,8 +1,6 @@ #include "config.h" -#include #include #include -#include #include #include #include diff --git a/plugins/fetchinvoice.c b/plugins/fetchinvoice.c index c7013e694f0f..a18b82e18035 100644 --- a/plugins/fetchinvoice.c +++ b/plugins/fetchinvoice.c @@ -1,30 +1,20 @@ #include "config.h" -#include -#include -#include #include #include #include #include -#include #include #include -#include +#include #include -#include #include #include -#include #include #include -#include -#include -#include +#include #include #include -#include #include -#include #include static LIST_HEAD(sent_list); diff --git a/plugins/funder.c b/plugins/funder.c index cae9534db3e1..15ab3f1002a8 100644 --- a/plugins/funder.c +++ b/plugins/funder.c @@ -12,10 +12,10 @@ #include #include #include -#include #include #include #include +#include #include #include diff --git a/plugins/funder_policy.c b/plugins/funder_policy.c index 1ce2cefc8aa1..fc84e8fcea80 100644 --- a/plugins/funder_policy.c +++ b/plugins/funder_policy.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include diff --git a/plugins/keysend.c b/plugins/keysend.c index 6104bf607ccd..aed5511fe516 100644 --- a/plugins/keysend.c +++ b/plugins/keysend.c @@ -1,14 +1,14 @@ #include "config.h" -#include #include #include #include #include -#include +#include #include #include #include -#include +#include +#include #include #include diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index 5409e00ebbd5..919ca7de3527 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -1,22 +1,23 @@ #include "config.h" -#include #include #include #include +#include #include #include +#include #include #include #include #include -#include #include +#include #include #include +#include #include +#include #include -#include -#include #include static struct gossmap *global_gossmap; diff --git a/plugins/libplugin-pay.h b/plugins/libplugin-pay.h index bc1ec51b5dc9..4df7d3fcafa2 100644 --- a/plugins/libplugin-pay.h +++ b/plugins/libplugin-pay.h @@ -3,11 +3,8 @@ #include "config.h" #include -#include -#include -#include #include -#include +#include struct legacy_payload { struct short_channel_id scid; diff --git a/plugins/libplugin.c b/plugins/libplugin.c index 36a74d9f8134..47aa7bd74d9b 100644 --- a/plugins/libplugin.c +++ b/plugins/libplugin.c @@ -1,26 +1,24 @@ #include "config.h" -#include -#include #include #include +#include #include #include #include #include #include +#include #include #include -#include #include #include #include #include #include #include +#include #include #include -#include -#include #define READ_CHUNKSIZE 4096 diff --git a/plugins/libplugin.h b/plugins/libplugin.h index 550429950995..cec028b2fed5 100644 --- a/plugins/libplugin.h +++ b/plugins/libplugin.h @@ -3,21 +3,11 @@ #define LIGHTNING_PLUGINS_LIBPLUGIN_H #include "config.h" -#include -#include -#include -#include -#include #include -#include -#include #include #include -#include #include -#include #include -#include struct json_out; struct htable; diff --git a/plugins/offers.c b/plugins/offers.c index 575d7a8b0539..383beff08e1e 100644 --- a/plugins/offers.c +++ b/plugins/offers.c @@ -1,16 +1,14 @@ /* This plugin covers both sending and receiving offers */ #include "config.h" -#include #include -#include #include #include #include #include -#include #include #include #include +#include #include #include #include @@ -19,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/offers_inv_hook.c b/plugins/offers_inv_hook.c index 07bc1a7ed6b6..3e72fae0fe4a 100644 --- a/plugins/offers_inv_hook.c +++ b/plugins/offers_inv_hook.c @@ -3,10 +3,10 @@ #include #include #include +#include #include #include #include -#include /* We need to keep the reply path around so we can reply if error */ struct inv { diff --git a/plugins/offers_invreq_hook.c b/plugins/offers_invreq_hook.c index 5c8cb142c4c3..153def675135 100644 --- a/plugins/offers_invreq_hook.c +++ b/plugins/offers_invreq_hook.c @@ -1,23 +1,19 @@ #include "config.h" -#include #include #include -#include #include #include -#include #include #include +#include #include #include #include -#include #include #include -#include +#include #include #include -#include #include /* We need to keep the reply path around so we can reply with invoice */ diff --git a/plugins/offers_offer.c b/plugins/offers_offer.c index e7c7ded1893c..34b6844d4adc 100644 --- a/plugins/offers_offer.c +++ b/plugins/offers_offer.c @@ -1,9 +1,8 @@ #include "config.h" -#include #include -#include #include #include +#include #include #include #include diff --git a/plugins/pay.c b/plugins/pay.c index 7deaf85bc518..ba1353a54631 100644 --- a/plugins/pay.c +++ b/plugins/pay.c @@ -1,22 +1,15 @@ #include "config.h" -#include #include -#include #include -#include -#include -#include -#include #include #include +#include #include #include #include #include -#include #include #include -#include #include /* Public key of this node. */ diff --git a/plugins/recklessrpc.c b/plugins/recklessrpc.c index 3c86a0824eb5..5b58495dba5c 100644 --- a/plugins/recklessrpc.c +++ b/plugins/recklessrpc.c @@ -5,15 +5,12 @@ #include #include #include -#include #include #include -#include #include #include #include #include -#include static struct plugin *plugin; diff --git a/plugins/recover.c b/plugins/recover.c index fcc7b74f8e6c..850f85d4531b 100644 --- a/plugins/recover.c +++ b/plugins/recover.c @@ -1,14 +1,10 @@ #include "config.h" #include -#include #include -#include -#include #include #include #include #include -#include /* How long to wait after startup before starting the timer loop */ #define STARTUP_TIME 2 diff --git a/plugins/renepay/Makefile b/plugins/renepay/Makefile index 5300fecb0f04..d28ca33018af 100644 --- a/plugins/renepay/Makefile +++ b/plugins/renepay/Makefile @@ -42,9 +42,9 @@ PLUGIN_RENEPAY_OBJS := $(PLUGIN_RENEPAY_SRC:.c=.o) PLUGIN_ALL_SRC += $(PLUGIN_RENEPAY_SRC) PLUGIN_ALL_HEADER += $(PLUGIN_RENEPAY_HDRS) -# Make all plugins depend on all plugin headers, for simplicity. -$(PLUGIN_RENEPAY_OBJS): $(PLUGIN_RENEPAY_HDRS) +# Make all plugins depend on all plugin headers, for simplicity (and this file). +$(PLUGIN_RENEPAY_OBJS): $(PLUGIN_RENEPAY_HDRS) plugins/renepay/Makefile -plugins/cln-renepay: $(PLUGIN_RENEPAY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) bitcoin/chainparams.o common/gossmap.o common/gossmods_listpeerchannels.o common/fp16.o common/dijkstra.o common/bolt12.o common/bolt12_merkle.o common/sciddir_or_pubkey.o wire/bolt12_wiregen.o wire/onion_wiregen.o common/sphinx.o common/onion_encode.o common/hmac.o common/onionreply.o +plugins/cln-renepay: $(PLUGIN_RENEPAY_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a include plugins/renepay/test/Makefile diff --git a/plugins/renepay/disabledmap.c b/plugins/renepay/disabledmap.c index 68492eced369..badeac868637 100644 --- a/plugins/renepay/disabledmap.c +++ b/plugins/renepay/disabledmap.c @@ -1,4 +1,5 @@ #include "config.h" +#include #include struct disabledmap *disabledmap_new(const tal_t *ctx) diff --git a/plugins/renepay/main.c b/plugins/renepay/main.c index 01b4d13be34c..8d92ea78e856 100644 --- a/plugins/renepay/main.c +++ b/plugins/renepay/main.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/renepay/test/Makefile b/plugins/renepay/test/Makefile index ba3c49b1ff94..2c86948dfe55 100644 --- a/plugins/renepay/test/Makefile +++ b/plugins/renepay/test/Makefile @@ -6,18 +6,13 @@ PLUGIN_RENEPAY_TEST_PROGRAMS := $(PLUGIN_RENEPAY_TEST_OBJS:.o=) ALL_C_SOURCES += $(PLUGIN_RENEPAY_TEST_SRC) ALL_TEST_PROGRAMS += $(PLUGIN_RENEPAY_TEST_PROGRAMS) -$(PLUGIN_RENEPAY_TEST_OBJS): $(PLUGIN_RENEPAY_SRC) plugins/renepay/test/common.h +$(PLUGIN_RENEPAY_TEST_OBJS): $(PLUGIN_RENEPAY_SRC) plugins/renepay/test/common.h plugins/renepay/test/Makefile -PLUGIN_RENEPAY_TEST_COMMON_OBJS := \ +$(PLUGIN_RENEPAY_TEST_PROGRAMS): \ plugins/renepay/dijkstra.o \ plugins/renepay/chan_extra.o \ - bitcoin/chainparams.o \ - common/gossmap.o \ - common/fp16.o \ - common/dijkstra.o \ - gossipd/gossip_store_wiregen.o - -$(PLUGIN_RENEPAY_TEST_PROGRAMS): $(PLUGIN_RENEPAY_TEST_COMMON_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) + gossipd/gossip_store_wiregen.o \ + libcommon.a check-renepay: $(PLUGIN_RENEPAY_TEST_PROGRAMS:%=unittest/%) diff --git a/plugins/renepay/test/run-arc.c b/plugins/renepay/test/run-arc.c index 793a0e70a0e2..8806508d97bb 100644 --- a/plugins/renepay/test/run-arc.c +++ b/plugins/renepay/test/run-arc.c @@ -14,10 +14,6 @@ #include "../mcf.c" /* AUTOGENERATED MOCKS START */ -/* Generated stub for sciddir_or_pubkey_from_node_id */ -bool sciddir_or_pubkey_from_node_id(struct sciddir_or_pubkey *sciddpk UNNEEDED, - const struct node_id *node_id UNNEEDED) -{ fprintf(stderr, "sciddir_or_pubkey_from_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ int main(int argc, char *argv[]) diff --git a/plugins/renepay/test/run-bottleneck.c b/plugins/renepay/test/run-bottleneck.c index f22d45fbbf6e..6e8bda76240a 100644 --- a/plugins/renepay/test/run-bottleneck.c +++ b/plugins/renepay/test/run-bottleneck.c @@ -19,10 +19,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for sciddir_or_pubkey_from_node_id */ -bool sciddir_or_pubkey_from_node_id(struct sciddir_or_pubkey *sciddpk UNNEEDED, - const struct node_id *node_id UNNEEDED) -{ fprintf(stderr, "sciddir_or_pubkey_from_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ static u8 empty_map[] = {10}; diff --git a/plugins/renepay/test/run-dijkstra.c b/plugins/renepay/test/run-dijkstra.c index 49e7a364f53b..3c43b1188940 100644 --- a/plugins/renepay/test/run-dijkstra.c +++ b/plugins/renepay/test/run-dijkstra.c @@ -11,10 +11,6 @@ #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for sciddir_or_pubkey_from_node_id */ -bool sciddir_or_pubkey_from_node_id(struct sciddir_or_pubkey *sciddpk UNNEEDED, - const struct node_id *node_id UNNEEDED) -{ fprintf(stderr, "sciddir_or_pubkey_from_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ static void insertion_in_increasing_distance(const tal_t *ctx) diff --git a/plugins/renepay/test/run-mcf-diamond.c b/plugins/renepay/test/run-mcf-diamond.c index 59eb99790592..d1471e323f4b 100644 --- a/plugins/renepay/test/run-mcf-diamond.c +++ b/plugins/renepay/test/run-mcf-diamond.c @@ -18,6 +18,15 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for command_fail */ +struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_fail called!\n"); abort(); } +/* Generated stub for command_finished */ +struct command_result *command_finished(struct command *cmd UNNEEDED, struct json_stream *response) + +{ fprintf(stderr, "command_finished called!\n"); abort(); } /* Generated stub for disabledmap_add_channel */ void disabledmap_add_channel(struct disabledmap *p UNNEEDED, struct short_channel_id_dir scidd UNNEEDED) @@ -42,18 +51,30 @@ void disabledmap_warn_channel(struct disabledmap *p UNNEEDED, /* Generated stub for json_add_payment */ void json_add_payment(struct json_stream *s UNNEEDED, const struct payment *payment UNNEEDED) { fprintf(stderr, "json_add_payment called!\n"); abort(); } +/* Generated stub for jsonrpc_stream_success */ +struct json_stream *jsonrpc_stream_success(struct command *cmd) + +{ fprintf(stderr, "jsonrpc_stream_success called!\n"); abort(); } /* Generated stub for new_routetracker */ struct routetracker *new_routetracker(const tal_t *ctx UNNEEDED, struct payment *payment UNNEEDED) { fprintf(stderr, "new_routetracker called!\n"); abort(); } /* Generated stub for pay_plugin */ struct pay_plugin *pay_plugin; +/* Generated stub for plugin_err */ +void plugin_err(struct plugin *p UNNEEDED, const char *fmt UNNEEDED, ...) +{ fprintf(stderr, "plugin_err called!\n"); abort(); } +/* Generated stub for plugin_log */ +void plugin_log(struct plugin *p UNNEEDED, enum log_level l UNNEEDED, const char *fmt UNNEEDED, ...) +{ fprintf(stderr, "plugin_log called!\n"); abort(); } +/* Generated stub for plugin_notify_message */ +void plugin_notify_message(struct command *cmd UNNEEDED, + enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "plugin_notify_message called!\n"); abort(); } /* Generated stub for routetracker_cleanup */ void routetracker_cleanup(struct routetracker *routetracker UNNEEDED) { fprintf(stderr, "routetracker_cleanup called!\n"); abort(); } -/* Generated stub for sciddir_or_pubkey_from_node_id */ -bool sciddir_or_pubkey_from_node_id(struct sciddir_or_pubkey *sciddpk UNNEEDED, - const struct node_id *node_id UNNEEDED) -{ fprintf(stderr, "sciddir_or_pubkey_from_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ static u8 empty_map[] = { diff --git a/plugins/renepay/test/run-mcf.c b/plugins/renepay/test/run-mcf.c index 9b9b50a24c9d..14b68a8ba320 100644 --- a/plugins/renepay/test/run-mcf.c +++ b/plugins/renepay/test/run-mcf.c @@ -20,6 +20,15 @@ #include /* AUTOGENERATED MOCKS START */ +/* Generated stub for command_fail */ +struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_fail called!\n"); abort(); } +/* Generated stub for command_finished */ +struct command_result *command_finished(struct command *cmd UNNEEDED, struct json_stream *response) + +{ fprintf(stderr, "command_finished called!\n"); abort(); } /* Generated stub for disabledmap_add_channel */ void disabledmap_add_channel(struct disabledmap *p UNNEEDED, struct short_channel_id_dir scidd UNNEEDED) @@ -44,18 +53,30 @@ void disabledmap_warn_channel(struct disabledmap *p UNNEEDED, /* Generated stub for json_add_payment */ void json_add_payment(struct json_stream *s UNNEEDED, const struct payment *payment UNNEEDED) { fprintf(stderr, "json_add_payment called!\n"); abort(); } +/* Generated stub for jsonrpc_stream_success */ +struct json_stream *jsonrpc_stream_success(struct command *cmd) + +{ fprintf(stderr, "jsonrpc_stream_success called!\n"); abort(); } /* Generated stub for new_routetracker */ struct routetracker *new_routetracker(const tal_t *ctx UNNEEDED, struct payment *payment UNNEEDED) { fprintf(stderr, "new_routetracker called!\n"); abort(); } /* Generated stub for pay_plugin */ struct pay_plugin *pay_plugin; +/* Generated stub for plugin_err */ +void plugin_err(struct plugin *p UNNEEDED, const char *fmt UNNEEDED, ...) +{ fprintf(stderr, "plugin_err called!\n"); abort(); } +/* Generated stub for plugin_log */ +void plugin_log(struct plugin *p UNNEEDED, enum log_level l UNNEEDED, const char *fmt UNNEEDED, ...) +{ fprintf(stderr, "plugin_log called!\n"); abort(); } +/* Generated stub for plugin_notify_message */ +void plugin_notify_message(struct command *cmd UNNEEDED, + enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "plugin_notify_message called!\n"); abort(); } /* Generated stub for routetracker_cleanup */ void routetracker_cleanup(struct routetracker *routetracker UNNEEDED) { fprintf(stderr, "routetracker_cleanup called!\n"); abort(); } -/* Generated stub for sciddir_or_pubkey_from_node_id */ -bool sciddir_or_pubkey_from_node_id(struct sciddir_or_pubkey *sciddpk UNNEEDED, - const struct node_id *node_id UNNEEDED) -{ fprintf(stderr, "sciddir_or_pubkey_from_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ static void swap(int *a, int *b) diff --git a/plugins/renepay/test/run-route_map.c b/plugins/renepay/test/run-route_map.c index 5dad081810a1..f1ee82ed34e4 100644 --- a/plugins/renepay/test/run-route_map.c +++ b/plugins/renepay/test/run-route_map.c @@ -21,10 +21,6 @@ #include "../route.c" /* AUTOGENERATED MOCKS START */ -/* Generated stub for sciddir_or_pubkey_from_node_id */ -bool sciddir_or_pubkey_from_node_id(struct sciddir_or_pubkey *sciddpk UNNEEDED, - const struct node_id *node_id UNNEEDED) -{ fprintf(stderr, "sciddir_or_pubkey_from_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ static void destroy_route( diff --git a/plugins/renepay/test/run-testflow.c b/plugins/renepay/test/run-testflow.c index 43a2b556f253..9bbe897d5df7 100644 --- a/plugins/renepay/test/run-testflow.c +++ b/plugins/renepay/test/run-testflow.c @@ -20,6 +20,15 @@ #include "../mcf.c" /* AUTOGENERATED MOCKS START */ +/* Generated stub for command_fail */ +struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_fail called!\n"); abort(); } +/* Generated stub for command_finished */ +struct command_result *command_finished(struct command *cmd UNNEEDED, struct json_stream *response) + +{ fprintf(stderr, "command_finished called!\n"); abort(); } /* Generated stub for disabledmap_add_channel */ void disabledmap_add_channel(struct disabledmap *p UNNEEDED, struct short_channel_id_dir scidd UNNEEDED) @@ -44,18 +53,30 @@ void disabledmap_warn_channel(struct disabledmap *p UNNEEDED, /* Generated stub for json_add_payment */ void json_add_payment(struct json_stream *s UNNEEDED, const struct payment *payment UNNEEDED) { fprintf(stderr, "json_add_payment called!\n"); abort(); } +/* Generated stub for jsonrpc_stream_success */ +struct json_stream *jsonrpc_stream_success(struct command *cmd) + +{ fprintf(stderr, "jsonrpc_stream_success called!\n"); abort(); } /* Generated stub for new_routetracker */ struct routetracker *new_routetracker(const tal_t *ctx UNNEEDED, struct payment *payment UNNEEDED) { fprintf(stderr, "new_routetracker called!\n"); abort(); } /* Generated stub for pay_plugin */ struct pay_plugin *pay_plugin; +/* Generated stub for plugin_err */ +void plugin_err(struct plugin *p UNNEEDED, const char *fmt UNNEEDED, ...) +{ fprintf(stderr, "plugin_err called!\n"); abort(); } +/* Generated stub for plugin_log */ +void plugin_log(struct plugin *p UNNEEDED, enum log_level l UNNEEDED, const char *fmt UNNEEDED, ...) +{ fprintf(stderr, "plugin_log called!\n"); abort(); } +/* Generated stub for plugin_notify_message */ +void plugin_notify_message(struct command *cmd UNNEEDED, + enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "plugin_notify_message called!\n"); abort(); } /* Generated stub for routetracker_cleanup */ void routetracker_cleanup(struct routetracker *routetracker UNNEEDED) { fprintf(stderr, "routetracker_cleanup called!\n"); abort(); } -/* Generated stub for sciddir_or_pubkey_from_node_id */ -bool sciddir_or_pubkey_from_node_id(struct sciddir_or_pubkey *sciddpk UNNEEDED, - const struct node_id *node_id UNNEEDED) -{ fprintf(stderr, "sciddir_or_pubkey_from_node_id called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ static const u8 canned_map[] = { diff --git a/plugins/spender/multifundchannel.c b/plugins/spender/multifundchannel.c index 5fef05204c6a..af425736e7c8 100644 --- a/plugins/spender/multifundchannel.c +++ b/plugins/spender/multifundchannel.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/plugins/spender/multiwithdraw.c b/plugins/spender/multiwithdraw.c index c6f448131e46..7950d1d1c980 100644 --- a/plugins/spender/multiwithdraw.c +++ b/plugins/spender/multiwithdraw.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include diff --git a/plugins/spender/openchannel.c b/plugins/spender/openchannel.c index 90c5cdb28a46..85d15b06f977 100644 --- a/plugins/spender/openchannel.c +++ b/plugins/spender/openchannel.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include diff --git a/plugins/spender/splice.c b/plugins/spender/splice.c index 1c8ce72fa9ff..35098c0c7f31 100644 --- a/plugins/spender/splice.c +++ b/plugins/spender/splice.c @@ -11,6 +11,7 @@ #include #include #include +#include #include struct abort_pkg { diff --git a/plugins/sql.c b/plugins/sql.c index 7b7e21bf4793..8848abe45aaa 100644 --- a/plugins/sql.c +++ b/plugins/sql.c @@ -2,7 +2,6 @@ #include "config.h" #include #include -#include #include #include #include @@ -16,8 +15,6 @@ #include #include #include -#include -#include #include /* Minimized schemas. C23 #embed, Where Art Thou? */ diff --git a/plugins/test/Makefile b/plugins/test/Makefile index 3b5712d5ac09..167e0deb1571 100644 --- a/plugins/test/Makefile +++ b/plugins/test/Makefile @@ -1,4 +1,4 @@ -# Note that these actually #include everything they need, except ccan/ and bitcoin/. +# Note that these actually #include everything they need, except ccan/, bitcoin/ and wire/ # That allows for unit testing of statics, and special effects. PLUGIN_TEST_SRC := $(wildcard plugins/test/run-*.c) PLUGIN_TEST_OBJS := $(PLUGIN_TEST_SRC:.c=.o) @@ -7,19 +7,7 @@ PLUGIN_TEST_PROGRAMS := $(PLUGIN_TEST_OBJS:.o=) ALL_C_SOURCES += $(PLUGIN_TEST_SRC) ALL_TEST_PROGRAMS += $(PLUGIN_TEST_PROGRAMS) -PLUGIN_TEST_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/pseudorand.o \ - common/setup.o \ - common/utils.o - plugins/test/run-route-overlong: \ - common/dijkstra.o \ - common/fp16.o \ - common/gossmap.o \ - common/node_id.o \ - common/route.o \ gossipd/gossip_store_wiregen.o \ plugins/channel_hint.o @@ -31,8 +19,8 @@ plugins/test/run-route-calc: \ gossipd/gossip_store_wiregen.o \ plugins/channel_hint.o -$(PLUGIN_TEST_PROGRAMS): $(BITCOIN_OBJS) $(WIRE_OBJS) $(PLUGIN_TEST_COMMON_OBJS) +$(PLUGIN_TEST_PROGRAMS): libcommon.a -$(PLUGIN_TEST_OBJS): $(PLUGIN_FUNDER_HEADER) $(PLUGIN_FUNDER_SRC) +$(PLUGIN_TEST_OBJS): $(PLUGIN_ALL_HEADER) $(PLUGIN_ALL_SRC) plugins/test/Makefile check-units: $(PLUGIN_TEST_PROGRAMS:%=unittest/%) diff --git a/plugins/test/Makefile2 b/plugins/test/Makefile2 deleted file mode 100644 index 39a27f1832c9..000000000000 --- a/plugins/test/Makefile2 +++ /dev/null @@ -1,21 +0,0 @@ -# Note that these actually #include everything they need, except ccan/ and bitcoin/. -# That allows for unit testing of statics, and special effects. -PLUGIN_TEST_SRC := $(wildcard plugins/test/run-*.c) -PLUGIN_TEST_OBJS := $(PLUGIN_TEST_SRC:.c=.o) -PLUGIN_TEST_PROGRAMS := $(PLUGIN_TEST_OBJS:.o=) - -ALL_C_SOURCES += $(PLUGIN_TEST_SRC) -ALL_TEST_PROGRAMS += $(PLUGIN_TEST_PROGRAMS) - -update-mocks: $(PLUGIN_TEST_SRC:%=update-mocks/%) - -$(PLUGIN_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(PLUGIN_COMMON_OBJS) - -$(PLUGIN_TEST_OBJS): $(PLUGIN_ALL_HEADERS) $(PLUGIN_ALL_SRC) - -check-units: $(PLUGIN_TEST_PROGRAMS:%=unittest/%) - -plugins/test/run-route-overlong: \ - common/dijkstra.o \ - common/gossmap.o \ - common/route.o diff --git a/plugins/test/run-funder_policy.c b/plugins/test/run-funder_policy.c index 8880b905999a..e2d245014190 100644 --- a/plugins/test/run-funder_policy.c +++ b/plugins/test/run-funder_policy.c @@ -1,37 +1,30 @@ #include "config.h" #include "../funder_policy.c" #include +#include #include #include /* AUTOGENERATED MOCKS START */ -/* Generated stub for fromwire_bigsize */ -bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_bigsize called!\n"); abort(); } -/* Generated stub for fromwire_channel_id */ -bool 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_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 json_add_string */ -void json_add_string(struct json_stream *js UNNEEDED, - const char *fieldname UNNEEDED, - const char *str TAKES UNNEEDED) -{ fprintf(stderr, "json_add_string called!\n"); abort(); } -/* Generated stub for pubkey_from_node_id */ -bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "pubkey_from_node_id 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_node_id */ -void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) -{ fprintf(stderr, "towire_node_id called!\n"); abort(); } +/* Generated stub for command_check_only */ +bool command_check_only(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_check_only called!\n"); abort(); } +/* Generated stub for command_dev_apis */ +bool command_dev_apis(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_dev_apis called!\n"); abort(); } +/* Generated stub for command_fail */ +struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_fail called!\n"); abort(); } +/* Generated stub for command_filter_ptr */ +struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_filter_ptr called!\n"); abort(); } +/* Generated stub for command_log */ +void command_log(struct command *cmd UNNEEDED, enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_log called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ struct test_case { diff --git a/plugins/test/run-route-calc.c b/plugins/test/run-route-calc.c index 9f8682e03030..de62e98155fc 100644 --- a/plugins/test/run-route-calc.c +++ b/plugins/test/run-route-calc.c @@ -4,6 +4,7 @@ #include "../../common/dijkstra.c" #include "../libplugin-pay.c" #include +#include #include #include #include @@ -17,239 +18,43 @@ struct command *aux_command(const struct command *cmd) { fprintf(stderr, "aux_command called!\n"); abort(); } -/* Generated stub for blinded_onion_hops */ -u8 **blinded_onion_hops(const tal_t *ctx UNNEEDED, - struct amount_msat final_amount UNNEEDED, - u32 final_cltv UNNEEDED, - struct amount_msat total_amount UNNEEDED, - const struct blinded_path *path UNNEEDED) -{ fprintf(stderr, "blinded_onion_hops called!\n"); abort(); } +/* Generated stub for command_check_only */ +bool command_check_only(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_check_only called!\n"); abort(); } +/* Generated stub for command_dev_apis */ +bool command_dev_apis(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_dev_apis called!\n"); abort(); } +/* Generated stub for command_fail */ +struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_fail called!\n"); abort(); } +/* Generated stub for command_filter_ptr */ +struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_filter_ptr called!\n"); abort(); } /* Generated stub for command_finished */ struct command_result *command_finished(struct command *cmd UNNEEDED, struct json_stream *response) { fprintf(stderr, "command_finished called!\n"); abort(); } +/* Generated stub for command_log */ +void command_log(struct command *cmd UNNEEDED, enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_log called!\n"); abort(); } /* Generated stub for command_still_pending */ struct command_result *command_still_pending(struct command *cmd) { fprintf(stderr, "command_still_pending called!\n"); abort(); } -/* Generated stub for daemon_poll */ -int daemon_poll(struct pollfd *fds UNNEEDED, nfds_t nfds UNNEEDED, int timeout UNNEEDED) -{ fprintf(stderr, "daemon_poll 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 fromwire_bigsize */ -bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_bigsize called!\n"); abort(); } -/* Generated stub for fromwire_channel_id */ -bool 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 gossmod_add_localchan */ -void gossmod_add_localchan(struct gossmap_localmods *mods UNNEEDED, - const struct node_id *self UNNEEDED, - const struct node_id *peer UNNEEDED, - const struct short_channel_id_dir *scidd UNNEEDED, - struct amount_msat capacity_msat UNNEEDED, - struct amount_msat htlcmin UNNEEDED, - struct amount_msat htlcmax UNNEEDED, - struct amount_msat spendable UNNEEDED, - struct amount_msat total_htlcmax UNNEEDED, - struct amount_msat fee_base UNNEEDED, - u32 fee_proportional UNNEEDED, - u16 cltv_delta UNNEEDED, - bool enabled UNNEEDED, - const char *buf UNUSED UNNEEDED, - const jsmntok_t *chantok UNUSED UNNEEDED, - void *cbarg UNUSED UNNEEDED) -{ fprintf(stderr, "gossmod_add_localchan called!\n"); abort(); } -/* Generated stub for gossmods_from_listpeerchannels_ */ -struct gossmap_localmods *gossmods_from_listpeerchannels_(const tal_t *ctx UNNEEDED, - const struct node_id *self UNNEEDED, - const char *buf UNNEEDED, - const jsmntok_t *toks UNNEEDED, - bool zero_rates UNNEEDED, - void (*cb)(struct gossmap_localmods *mods UNNEEDED, - const struct node_id *self_ UNNEEDED, - const struct node_id *peer UNNEEDED, - const struct short_channel_id_dir *scidd UNNEEDED, - struct amount_msat capacity_msat UNNEEDED, - struct amount_msat htlcmin UNNEEDED, - struct amount_msat htlcmax UNNEEDED, - struct amount_msat spendable UNNEEDED, - struct amount_msat total_htlcmax UNNEEDED, - struct amount_msat fee_base UNNEEDED, - u32 fee_proportional UNNEEDED, - u16 cltv_delta UNNEEDED, - bool enabled UNNEEDED, - const char *buf_ UNNEEDED, - const jsmntok_t *chantok UNNEEDED, - void *cbarg_) UNNEEDED, - void *cbarg UNNEEDED) -{ fprintf(stderr, "gossmods_from_listpeerchannels_ called!\n"); abort(); } -/* Generated stub for json_add_amount_msat */ -void json_add_amount_msat(struct json_stream *result UNNEEDED, - const char *msatfieldname UNNEEDED, - struct amount_msat msat) - -{ fprintf(stderr, "json_add_amount_msat called!\n"); abort(); } -/* Generated stub for json_add_bool */ -void json_add_bool(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - bool value UNNEEDED) -{ fprintf(stderr, "json_add_bool called!\n"); abort(); } -/* Generated stub for json_add_hex_talarr */ -void json_add_hex_talarr(struct json_stream *result UNNEEDED, - const char *fieldname UNNEEDED, - const tal_t *data UNNEEDED) -{ fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); } -/* Generated stub for json_add_invstring */ -void json_add_invstring(struct json_stream *result UNNEEDED, const char *invstring UNNEEDED) -{ fprintf(stderr, "json_add_invstring called!\n"); abort(); } -/* Generated stub for json_add_node_id */ -void json_add_node_id(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct node_id *id UNNEEDED) -{ fprintf(stderr, "json_add_node_id called!\n"); abort(); } -/* Generated stub for json_add_num */ -void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - unsigned int value UNNEEDED) -{ fprintf(stderr, "json_add_num called!\n"); abort(); } -/* Generated stub for json_add_preimage */ -void json_add_preimage(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const struct preimage *preimage UNNEEDED) -{ fprintf(stderr, "json_add_preimage called!\n"); abort(); } -/* Generated stub for json_add_secret */ -void json_add_secret(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct secret *secret UNNEEDED) -{ fprintf(stderr, "json_add_secret called!\n"); abort(); } -/* Generated stub for json_add_sha256 */ -void json_add_sha256(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const struct sha256 *hash UNNEEDED) -{ fprintf(stderr, "json_add_sha256 called!\n"); abort(); } -/* Generated stub for json_add_short_channel_id */ -void json_add_short_channel_id(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - struct short_channel_id id UNNEEDED) -{ fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); } -/* Generated stub for json_add_short_channel_id_dir */ -void json_add_short_channel_id_dir(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - struct short_channel_id_dir idd UNNEEDED) -{ fprintf(stderr, "json_add_short_channel_id_dir called!\n"); abort(); } -/* Generated stub for json_add_string */ -void json_add_string(struct json_stream *js UNNEEDED, - const char *fieldname UNNEEDED, - const char *str TAKES UNNEEDED) -{ fprintf(stderr, "json_add_string called!\n"); abort(); } -/* Generated stub for json_add_timeabs */ -void json_add_timeabs(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - struct timeabs t UNNEEDED) -{ fprintf(stderr, "json_add_timeabs called!\n"); abort(); } -/* Generated stub for json_add_u32 */ -void json_add_u32(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - uint32_t value UNNEEDED) -{ fprintf(stderr, "json_add_u32 called!\n"); abort(); } -/* Generated stub for json_add_u64 */ -void json_add_u64(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - uint64_t value UNNEEDED) -{ fprintf(stderr, "json_add_u64 called!\n"); abort(); } -/* Generated stub for json_array_end */ -void json_array_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_array_end called!\n"); abort(); } -/* Generated stub for json_array_start */ -void json_array_start(struct json_stream *js UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_array_start called!\n"); abort(); } -/* Generated stub for json_get_membern */ -const jsmntok_t *json_get_membern(const char *buffer UNNEEDED, - const jsmntok_t tok[] UNNEEDED, - const char *label UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "json_get_membern called!\n"); abort(); } -/* Generated stub for json_next */ -const jsmntok_t *json_next(const jsmntok_t *tok UNNEEDED) -{ fprintf(stderr, "json_next called!\n"); abort(); } -/* Generated stub for json_object_end */ -void json_object_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_object_end called!\n"); abort(); } -/* Generated stub for json_object_start */ -void json_object_start(struct json_stream *ks UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_object_start called!\n"); abort(); } -/* Generated stub for json_scan */ -const char *json_scan(const tal_t *ctx UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - const char *guide UNNEEDED, - ...) -{ fprintf(stderr, "json_scan called!\n"); abort(); } -/* Generated stub for json_strdup */ -char *json_strdup(const tal_t *ctx UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED) -{ fprintf(stderr, "json_strdup called!\n"); abort(); } -/* Generated stub for json_to_bool */ -bool json_to_bool(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, bool *b UNNEEDED) -{ fprintf(stderr, "json_to_bool called!\n"); abort(); } /* Generated stub for json_to_createonion_response */ struct createonion_response *json_to_createonion_response(const tal_t *ctx UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *toks UNNEEDED) { fprintf(stderr, "json_to_createonion_response called!\n"); abort(); } -/* Generated stub for json_to_int */ -bool json_to_int(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, int *num UNNEEDED) -{ fprintf(stderr, "json_to_int called!\n"); abort(); } /* Generated stub for json_to_listpeers_channels */ struct listpeers_channel **json_to_listpeers_channels(const tal_t *ctx UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED) { fprintf(stderr, "json_to_listpeers_channels called!\n"); abort(); } -/* Generated stub for json_to_msat */ -bool json_to_msat(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct amount_msat *msat UNNEEDED) -{ fprintf(stderr, "json_to_msat called!\n"); abort(); } -/* Generated stub for json_to_node_id */ -bool json_to_node_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct node_id *id UNNEEDED) -{ fprintf(stderr, "json_to_node_id called!\n"); abort(); } -/* Generated stub for json_to_number */ -bool json_to_number(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - unsigned int *num UNNEEDED) -{ fprintf(stderr, "json_to_number called!\n"); abort(); } -/* Generated stub for json_to_preimage */ -bool json_to_preimage(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, struct preimage *preimage UNNEEDED) -{ fprintf(stderr, "json_to_preimage called!\n"); abort(); } -/* Generated stub for json_to_sat */ -bool json_to_sat(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct amount_sat *sat UNNEEDED) -{ fprintf(stderr, "json_to_sat called!\n"); abort(); } -/* Generated stub for json_to_short_channel_id */ -bool json_to_short_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct short_channel_id *scid UNNEEDED) -{ fprintf(stderr, "json_to_short_channel_id called!\n"); abort(); } -/* Generated stub for json_to_short_channel_id_dir */ -bool json_to_short_channel_id_dir(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct short_channel_id_dir *scidd UNNEEDED) -{ fprintf(stderr, "json_to_short_channel_id_dir called!\n"); abort(); } -/* Generated stub for json_to_u16 */ -bool json_to_u16(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - uint16_t *num UNNEEDED) -{ fprintf(stderr, "json_to_u16 called!\n"); abort(); } -/* Generated stub for json_to_u32 */ -bool json_to_u32(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, u32 *num UNNEEDED) -{ fprintf(stderr, "json_to_u32 called!\n"); abort(); } -/* Generated stub for json_to_u64 */ -bool json_to_u64(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, u64 *num UNNEEDED) -{ fprintf(stderr, "json_to_u64 called!\n"); abort(); } -/* Generated stub for json_tok_bin_from_hex */ -u8 *json_tok_bin_from_hex(const tal_t *ctx UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED) -{ fprintf(stderr, "json_tok_bin_from_hex called!\n"); abort(); } -/* Generated stub for json_tok_full */ -const char *json_tok_full(const char *buffer UNNEEDED, const jsmntok_t *t UNNEEDED) -{ fprintf(stderr, "json_tok_full called!\n"); abort(); } -/* Generated stub for json_tok_full_len */ -int json_tok_full_len(const jsmntok_t *t UNNEEDED) -{ fprintf(stderr, "json_tok_full_len called!\n"); abort(); } -/* Generated stub for json_tok_strneq */ -bool json_tok_strneq(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - const char *str UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "json_tok_strneq called!\n"); abort(); } /* Generated stub for jsonrpc_request_start_ */ struct out_req *jsonrpc_request_start_(struct command *cmd UNNEEDED, const char *method UNNEEDED, @@ -278,12 +83,6 @@ struct json_stream *jsonrpc_stream_fail(struct command *cmd UNNEEDED, struct json_stream *jsonrpc_stream_success(struct command *cmd) { fprintf(stderr, "jsonrpc_stream_success called!\n"); abort(); } -/* Generated stub for memleak_add_helper_ */ -void memleak_add_helper_(const tal_t *p UNNEEDED, void (*cb)(struct htable *memtable UNNEEDED, - const tal_t *)){ } -/* Generated stub for memleak_scan_htable */ -void memleak_scan_htable(struct htable *memtable UNNEEDED, const struct htable *ht UNNEEDED) -{ fprintf(stderr, "memleak_scan_htable called!\n"); abort(); } /* Generated stub for notification_deprecated_out_ok */ bool notification_deprecated_out_ok(struct plugin *plugin UNNEEDED, const char *method UNNEEDED, @@ -291,9 +90,6 @@ bool notification_deprecated_out_ok(struct plugin *plugin UNNEEDED, const char *depr_start UNNEEDED, const char *depr_end UNNEEDED) { fprintf(stderr, "notification_deprecated_out_ok called!\n"); abort(); } -/* Generated stub for notleak_ */ -void *notleak_(void *ptr UNNEEDED, bool plus_children UNNEEDED) -{ fprintf(stderr, "notleak_ called!\n"); abort(); } /* Generated stub for plugin_err */ void plugin_err(struct plugin *p UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "plugin_err called!\n"); abort(); } @@ -320,27 +116,9 @@ void plugin_notify_message(struct command *cmd UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "plugin_notify_message called!\n"); abort(); } -/* Generated stub for random_select */ -bool random_select(double weight UNNEEDED, double *tot_weight UNNEEDED) -{ fprintf(stderr, "random_select called!\n"); abort(); } /* Generated stub for send_outreq */ struct command_result *send_outreq(const struct out_req *req UNNEEDED) { fprintf(stderr, "send_outreq 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 trace_span_end */ -void trace_span_end(const void *key UNNEEDED) -{ fprintf(stderr, "trace_span_end called!\n"); abort(); } -/* Generated stub for trace_span_start_ */ -void trace_span_start_(const char *name UNNEEDED, const void *key UNNEEDED) -{ fprintf(stderr, "trace_span_start_ called!\n"); abort(); } -/* Generated stub for trace_span_tag */ -void trace_span_tag(const void *key UNNEEDED, const char *name UNNEEDED, const char *value UNNEEDED) -{ fprintf(stderr, "trace_span_tag called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ #ifndef SUPERVERBOSE diff --git a/plugins/test/run-route-overlong.c b/plugins/test/run-route-overlong.c index 125244227259..fe2575cb5602 100644 --- a/plugins/test/run-route-overlong.c +++ b/plugins/test/run-route-overlong.c @@ -14,239 +14,43 @@ struct command *aux_command(const struct command *cmd) { fprintf(stderr, "aux_command called!\n"); abort(); } -/* Generated stub for blinded_onion_hops */ -u8 **blinded_onion_hops(const tal_t *ctx UNNEEDED, - struct amount_msat final_amount UNNEEDED, - u32 final_cltv UNNEEDED, - struct amount_msat total_amount UNNEEDED, - const struct blinded_path *path UNNEEDED) -{ fprintf(stderr, "blinded_onion_hops called!\n"); abort(); } +/* Generated stub for command_check_only */ +bool command_check_only(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_check_only called!\n"); abort(); } +/* Generated stub for command_dev_apis */ +bool command_dev_apis(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_dev_apis called!\n"); abort(); } +/* Generated stub for command_fail */ +struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_fail called!\n"); abort(); } +/* Generated stub for command_filter_ptr */ +struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_filter_ptr called!\n"); abort(); } /* Generated stub for command_finished */ struct command_result *command_finished(struct command *cmd UNNEEDED, struct json_stream *response) { fprintf(stderr, "command_finished called!\n"); abort(); } +/* Generated stub for command_log */ +void command_log(struct command *cmd UNNEEDED, enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_log called!\n"); abort(); } /* Generated stub for command_still_pending */ struct command_result *command_still_pending(struct command *cmd) { fprintf(stderr, "command_still_pending called!\n"); abort(); } -/* Generated stub for daemon_poll */ -int daemon_poll(struct pollfd *fds UNNEEDED, nfds_t nfds UNNEEDED, int timeout UNNEEDED) -{ fprintf(stderr, "daemon_poll 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 fromwire_bigsize */ -bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_bigsize called!\n"); abort(); } -/* Generated stub for fromwire_channel_id */ -bool 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 gossmod_add_localchan */ -void gossmod_add_localchan(struct gossmap_localmods *mods UNNEEDED, - const struct node_id *self UNNEEDED, - const struct node_id *peer UNNEEDED, - const struct short_channel_id_dir *scidd UNNEEDED, - struct amount_msat capacity_msat UNNEEDED, - struct amount_msat htlcmin UNNEEDED, - struct amount_msat htlcmax UNNEEDED, - struct amount_msat spendable UNNEEDED, - struct amount_msat total_htlcmax UNNEEDED, - struct amount_msat fee_base UNNEEDED, - u32 fee_proportional UNNEEDED, - u16 cltv_delta UNNEEDED, - bool enabled UNNEEDED, - const char *buf UNUSED UNNEEDED, - const jsmntok_t *chantok UNUSED UNNEEDED, - void *cbarg UNUSED UNNEEDED) -{ fprintf(stderr, "gossmod_add_localchan called!\n"); abort(); } -/* Generated stub for gossmods_from_listpeerchannels_ */ -struct gossmap_localmods *gossmods_from_listpeerchannels_(const tal_t *ctx UNNEEDED, - const struct node_id *self UNNEEDED, - const char *buf UNNEEDED, - const jsmntok_t *toks UNNEEDED, - bool zero_rates UNNEEDED, - void (*cb)(struct gossmap_localmods *mods UNNEEDED, - const struct node_id *self_ UNNEEDED, - const struct node_id *peer UNNEEDED, - const struct short_channel_id_dir *scidd UNNEEDED, - struct amount_msat capacity_msat UNNEEDED, - struct amount_msat htlcmin UNNEEDED, - struct amount_msat htlcmax UNNEEDED, - struct amount_msat spendable UNNEEDED, - struct amount_msat total_htlcmax UNNEEDED, - struct amount_msat fee_base UNNEEDED, - u32 fee_proportional UNNEEDED, - u16 cltv_delta UNNEEDED, - bool enabled UNNEEDED, - const char *buf_ UNNEEDED, - const jsmntok_t *chantok UNNEEDED, - void *cbarg_) UNNEEDED, - void *cbarg UNNEEDED) -{ fprintf(stderr, "gossmods_from_listpeerchannels_ called!\n"); abort(); } -/* Generated stub for json_add_amount_msat */ -void json_add_amount_msat(struct json_stream *result UNNEEDED, - const char *msatfieldname UNNEEDED, - struct amount_msat msat) - -{ fprintf(stderr, "json_add_amount_msat called!\n"); abort(); } -/* Generated stub for json_add_bool */ -void json_add_bool(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - bool value UNNEEDED) -{ fprintf(stderr, "json_add_bool called!\n"); abort(); } -/* Generated stub for json_add_hex_talarr */ -void json_add_hex_talarr(struct json_stream *result UNNEEDED, - const char *fieldname UNNEEDED, - const tal_t *data UNNEEDED) -{ fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); } -/* Generated stub for json_add_invstring */ -void json_add_invstring(struct json_stream *result UNNEEDED, const char *invstring UNNEEDED) -{ fprintf(stderr, "json_add_invstring called!\n"); abort(); } -/* Generated stub for json_add_node_id */ -void json_add_node_id(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct node_id *id UNNEEDED) -{ fprintf(stderr, "json_add_node_id called!\n"); abort(); } -/* Generated stub for json_add_num */ -void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - unsigned int value UNNEEDED) -{ fprintf(stderr, "json_add_num called!\n"); abort(); } -/* Generated stub for json_add_preimage */ -void json_add_preimage(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const struct preimage *preimage UNNEEDED) -{ fprintf(stderr, "json_add_preimage called!\n"); abort(); } -/* Generated stub for json_add_secret */ -void json_add_secret(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct secret *secret UNNEEDED) -{ fprintf(stderr, "json_add_secret called!\n"); abort(); } -/* Generated stub for json_add_sha256 */ -void json_add_sha256(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const struct sha256 *hash UNNEEDED) -{ fprintf(stderr, "json_add_sha256 called!\n"); abort(); } -/* Generated stub for json_add_short_channel_id */ -void json_add_short_channel_id(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - struct short_channel_id id UNNEEDED) -{ fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); } -/* Generated stub for json_add_short_channel_id_dir */ -void json_add_short_channel_id_dir(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - struct short_channel_id_dir idd UNNEEDED) -{ fprintf(stderr, "json_add_short_channel_id_dir called!\n"); abort(); } -/* Generated stub for json_add_string */ -void json_add_string(struct json_stream *js UNNEEDED, - const char *fieldname UNNEEDED, - const char *str TAKES UNNEEDED) -{ fprintf(stderr, "json_add_string called!\n"); abort(); } -/* Generated stub for json_add_timeabs */ -void json_add_timeabs(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - struct timeabs t UNNEEDED) -{ fprintf(stderr, "json_add_timeabs called!\n"); abort(); } -/* Generated stub for json_add_u32 */ -void json_add_u32(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - uint32_t value UNNEEDED) -{ fprintf(stderr, "json_add_u32 called!\n"); abort(); } -/* Generated stub for json_add_u64 */ -void json_add_u64(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - uint64_t value UNNEEDED) -{ fprintf(stderr, "json_add_u64 called!\n"); abort(); } -/* Generated stub for json_array_end */ -void json_array_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_array_end called!\n"); abort(); } -/* Generated stub for json_array_start */ -void json_array_start(struct json_stream *js UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_array_start called!\n"); abort(); } -/* Generated stub for json_get_membern */ -const jsmntok_t *json_get_membern(const char *buffer UNNEEDED, - const jsmntok_t tok[] UNNEEDED, - const char *label UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "json_get_membern called!\n"); abort(); } -/* Generated stub for json_next */ -const jsmntok_t *json_next(const jsmntok_t *tok UNNEEDED) -{ fprintf(stderr, "json_next called!\n"); abort(); } -/* Generated stub for json_object_end */ -void json_object_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_object_end called!\n"); abort(); } -/* Generated stub for json_object_start */ -void json_object_start(struct json_stream *ks UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_object_start called!\n"); abort(); } -/* Generated stub for json_scan */ -const char *json_scan(const tal_t *ctx UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - const char *guide UNNEEDED, - ...) -{ fprintf(stderr, "json_scan called!\n"); abort(); } -/* Generated stub for json_strdup */ -char *json_strdup(const tal_t *ctx UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED) -{ fprintf(stderr, "json_strdup called!\n"); abort(); } -/* Generated stub for json_to_bool */ -bool json_to_bool(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, bool *b UNNEEDED) -{ fprintf(stderr, "json_to_bool called!\n"); abort(); } /* Generated stub for json_to_createonion_response */ struct createonion_response *json_to_createonion_response(const tal_t *ctx UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *toks UNNEEDED) { fprintf(stderr, "json_to_createonion_response called!\n"); abort(); } -/* Generated stub for json_to_int */ -bool json_to_int(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, int *num UNNEEDED) -{ fprintf(stderr, "json_to_int called!\n"); abort(); } /* Generated stub for json_to_listpeers_channels */ struct listpeers_channel **json_to_listpeers_channels(const tal_t *ctx UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED) { fprintf(stderr, "json_to_listpeers_channels called!\n"); abort(); } -/* Generated stub for json_to_msat */ -bool json_to_msat(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct amount_msat *msat UNNEEDED) -{ fprintf(stderr, "json_to_msat called!\n"); abort(); } -/* Generated stub for json_to_node_id */ -bool json_to_node_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct node_id *id UNNEEDED) -{ fprintf(stderr, "json_to_node_id called!\n"); abort(); } -/* Generated stub for json_to_number */ -bool json_to_number(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - unsigned int *num UNNEEDED) -{ fprintf(stderr, "json_to_number called!\n"); abort(); } -/* Generated stub for json_to_preimage */ -bool json_to_preimage(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, struct preimage *preimage UNNEEDED) -{ fprintf(stderr, "json_to_preimage called!\n"); abort(); } -/* Generated stub for json_to_sat */ -bool json_to_sat(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct amount_sat *sat UNNEEDED) -{ fprintf(stderr, "json_to_sat called!\n"); abort(); } -/* Generated stub for json_to_short_channel_id */ -bool json_to_short_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct short_channel_id *scid UNNEEDED) -{ fprintf(stderr, "json_to_short_channel_id called!\n"); abort(); } -/* Generated stub for json_to_short_channel_id_dir */ -bool json_to_short_channel_id_dir(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct short_channel_id_dir *scidd UNNEEDED) -{ fprintf(stderr, "json_to_short_channel_id_dir called!\n"); abort(); } -/* Generated stub for json_to_u16 */ -bool json_to_u16(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - uint16_t *num UNNEEDED) -{ fprintf(stderr, "json_to_u16 called!\n"); abort(); } -/* Generated stub for json_to_u32 */ -bool json_to_u32(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, u32 *num UNNEEDED) -{ fprintf(stderr, "json_to_u32 called!\n"); abort(); } -/* Generated stub for json_to_u64 */ -bool json_to_u64(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, u64 *num UNNEEDED) -{ fprintf(stderr, "json_to_u64 called!\n"); abort(); } -/* Generated stub for json_tok_bin_from_hex */ -u8 *json_tok_bin_from_hex(const tal_t *ctx UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED) -{ fprintf(stderr, "json_tok_bin_from_hex called!\n"); abort(); } -/* Generated stub for json_tok_full */ -const char *json_tok_full(const char *buffer UNNEEDED, const jsmntok_t *t UNNEEDED) -{ fprintf(stderr, "json_tok_full called!\n"); abort(); } -/* Generated stub for json_tok_full_len */ -int json_tok_full_len(const jsmntok_t *t UNNEEDED) -{ fprintf(stderr, "json_tok_full_len called!\n"); abort(); } -/* Generated stub for json_tok_strneq */ -bool json_tok_strneq(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - const char *str UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "json_tok_strneq called!\n"); abort(); } /* Generated stub for jsonrpc_request_start_ */ struct out_req *jsonrpc_request_start_(struct command *cmd UNNEEDED, const char *method UNNEEDED, @@ -275,12 +79,6 @@ struct json_stream *jsonrpc_stream_fail(struct command *cmd UNNEEDED, struct json_stream *jsonrpc_stream_success(struct command *cmd) { fprintf(stderr, "jsonrpc_stream_success called!\n"); abort(); } -/* Generated stub for memleak_add_helper_ */ -void memleak_add_helper_(const tal_t *p UNNEEDED, void (*cb)(struct htable *memtable UNNEEDED, - const tal_t *)){ } -/* Generated stub for memleak_scan_htable */ -void memleak_scan_htable(struct htable *memtable UNNEEDED, const struct htable *ht UNNEEDED) -{ fprintf(stderr, "memleak_scan_htable called!\n"); abort(); } /* Generated stub for notification_deprecated_out_ok */ bool notification_deprecated_out_ok(struct plugin *plugin UNNEEDED, const char *method UNNEEDED, @@ -288,9 +86,6 @@ bool notification_deprecated_out_ok(struct plugin *plugin UNNEEDED, const char *depr_start UNNEEDED, const char *depr_end UNNEEDED) { fprintf(stderr, "notification_deprecated_out_ok called!\n"); abort(); } -/* Generated stub for notleak_ */ -void *notleak_(void *ptr UNNEEDED, bool plus_children UNNEEDED) -{ fprintf(stderr, "notleak_ called!\n"); abort(); } /* Generated stub for plugin_err */ void plugin_err(struct plugin *p UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "plugin_err called!\n"); abort(); } @@ -317,27 +112,9 @@ void plugin_notify_message(struct command *cmd UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "plugin_notify_message called!\n"); abort(); } -/* Generated stub for random_select */ -bool random_select(double weight UNNEEDED, double *tot_weight UNNEEDED) -{ fprintf(stderr, "random_select called!\n"); abort(); } /* Generated stub for send_outreq */ struct command_result *send_outreq(const struct out_req *req UNNEEDED) { fprintf(stderr, "send_outreq 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 trace_span_end */ -void trace_span_end(const void *key UNNEEDED) -{ fprintf(stderr, "trace_span_end called!\n"); abort(); } -/* Generated stub for trace_span_start_ */ -void trace_span_start_(const char *name UNNEEDED, const void *key UNNEEDED) -{ fprintf(stderr, "trace_span_start_ called!\n"); abort(); } -/* Generated stub for trace_span_tag */ -void trace_span_tag(const void *key UNNEEDED, const char *name UNNEEDED, const char *value UNNEEDED) -{ fprintf(stderr, "trace_span_tag called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ #ifndef SUPERVERBOSE diff --git a/plugins/topology.c b/plugins/topology.c index 4c84d02b92c2..944180de5f0f 100644 --- a/plugins/topology.c +++ b/plugins/topology.c @@ -1,7 +1,5 @@ #include "config.h" #include -#include -#include #include #include #include @@ -10,10 +8,9 @@ #include #include #include -#include #include -#include #include +#include #include /* Access via get_gossmap() */ diff --git a/plugins/txprepare.c b/plugins/txprepare.c index a0cbd1bf2eab..d1be784e9e51 100644 --- a/plugins/txprepare.c +++ b/plugins/txprepare.c @@ -1,15 +1,11 @@ #include "config.h" #include -#include #include -#include #include #include #include #include -#include #include -#include struct tx_output { struct amount_sat amount; diff --git a/plugins/xpay/Makefile b/plugins/xpay/Makefile index 56f53f4451aa..99441f18a7e0 100644 --- a/plugins/xpay/Makefile +++ b/plugins/xpay/Makefile @@ -9,7 +9,7 @@ PLUGIN_XPAY_OBJS := $(PLUGIN_XPAY_SRC:.c=.o) ALL_C_SOURCES += $(PLUGIN_XPAY_SRC) ALL_C_HEADERS += $(PLUGIN_XPAY_HDRS) -# Make all plugins depend on all plugin headers, for simplicity. -$(PLUGIN_XPAY_OBJS): $(PLUGIN_XPAY_HDRS) +# Make all plugins depend on all plugin headers, for simplicity (and this file) +$(PLUGIN_XPAY_OBJS): $(PLUGIN_XPAY_HDRS) plugins/xpay/Makefile -plugins/cln-xpay: $(PLUGIN_XPAY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) bitcoin/chainparams.o common/gossmap.o common/gossmods_listpeerchannels.o common/fp16.o common/dijkstra.o common/bolt12.o common/bolt12_merkle.o common/sciddir_or_pubkey.o wire/bolt12_wiregen.o wire/onion_wiregen.o common/onionreply.o common/onion_encode.o common/sphinx.o common/hmac.o +plugins/cln-xpay: $(PLUGIN_XPAY_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a diff --git a/plugins/xpay/xpay.c b/plugins/xpay/xpay.c index bf5f9cb46299..b4e2c41102ff 100644 --- a/plugins/xpay/xpay.c +++ b/plugins/xpay/xpay.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -20,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/tests/fuzz/Makefile b/tests/fuzz/Makefile index d7cdd0c9dbd2..139fd4fd3543 100644 --- a/tests/fuzz/Makefile +++ b/tests/fuzz/Makefile @@ -13,72 +13,13 @@ FUZZ_TARGETS_SRC := $(wildcard tests/fuzz/fuzz-*.c) FUZZ_TARGETS_OBJS := $(FUZZ_TARGETS_SRC:.c=.o) FUZZ_TARGETS_BIN := $(FUZZ_TARGETS_SRC:.c=) -FUZZ_COMMON_OBJS := \ - common/addr.o \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/base64.o \ - common/bech32.o \ - common/bech32_util.o \ - common/bigsize.o \ - common/bip32.o \ - common/blockheight_states.o \ - common/bolt11.o \ - common/bolt12_merkle.o \ - common/channel_config.o \ - common/channel_id.o \ - common/channel_type.o \ - common/close_tx.o \ - common/configdir.o \ - common/configvar.o \ - common/codex32.o \ - common/cryptomsg.o \ - common/daemon.o \ - common/daemon_conn.o \ - common/derive_basepoints.o \ - common/descriptor_checksum.o \ - common/features.o \ - common/fee_states.o \ - common/hash_u5.o \ - common/hsm_encryption.o \ - common/htlc_state.o \ - common/initial_channel.o \ - common/initial_commit_tx.o \ - common/key_derive.o \ - common/keyset.o \ - common/memleak.o \ - common/msg_queue.o \ - common/node_id.o \ - common/permute_tx.o \ - common/psbt_keypath.o \ - common/sciddir_or_pubkey.o \ - common/setup.o \ - common/status.o \ - common/status_wire.o \ - common/status_wiregen.o \ - common/utils.o \ - common/version.o \ - common/wireaddr.o \ - wire/bolt12_wiregen.o \ - wire/channel_type_wiregen.o \ - wire/fromwire.o \ - wire/onion_wiregen.o \ - wire/peer_wire.o \ - wire/peer_wiregen.o \ - wire/tlvstream.o \ - wire/towire.o \ - wire/wire_io.o \ - wire/wire_sync.o - -$(FUZZ_TARGETS_OBJS): $(COMMON_HEADERS) $(WIRE_HEADERS) $(COMMON_SRC) -$(FUZZ_TARGETS_BIN): $(LIBFUZZ_OBJS) $(FUZZ_COMMON_OBJS) $(BITCOIN_OBJS) - -tests/fuzz/fuzz-error-warning: common/peer_billboard.o \ - common/wire_error.o \ - common/peer_io.o \ - common/read_peer_msg.o \ - common/peer_status_wiregen.o +$(FUZZ_TARGETS_OBJS): $(COMMON_HEADERS) $(WIRE_HEADERS) $(COMMON_SRC) tests/fuzz/libfuzz.h +$(FUZZ_TARGETS_BIN): $(LIBFUZZ_OBJS) libcommon.a ALL_C_SOURCES += $(FUZZ_TARGETS_SRC) $(LIBFUZZ_SRC) ALL_FUZZ_TARGETS += $(FUZZ_TARGETS_BIN) + +# In non-fuzzing builds, these become normal tests. +ifneq ($(FUZZING),1) +check-units: $(FUZZ_TARGETS_BIN:%=unittest/%) +endif diff --git a/tests/fuzz/fuzz-bolt12-invrequest-decode.c b/tests/fuzz/fuzz-bolt12-invrequest-decode.c index 5a3ba5d2386f..159fb26b7c2f 100644 --- a/tests/fuzz/fuzz-bolt12-invrequest-decode.c +++ b/tests/fuzz/fuzz-bolt12-invrequest-decode.c @@ -1,4 +1,5 @@ #include "config.h" +#include #include #include #include diff --git a/tests/fuzz/libfuzz.c b/tests/fuzz/libfuzz.c index 98c5fd055bec..4541938b8e4c 100644 --- a/tests/fuzz/libfuzz.c +++ b/tests/fuzz/libfuzz.c @@ -2,10 +2,19 @@ #include #include +#include +#include +#include +#include #include +#include +#include +#include #include #include +#include #include +#include int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); int LLVMFuzzerInitialize(int *argc, char ***argv); @@ -118,3 +127,38 @@ size_t cross_over(const u8 *in1, size_t in1_size, const u8 *in2, max_out_size); return overwrite_part(in1, in1_size, in2, in2_size, out, max_out_size); } + +/* In non-fuzzing builds, these become unit tests which just run the corpora: + * this is also good for attaching a debugger to! */ +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION +int main(int argc, char *argv[]) +{ + DIR *d; + struct dirent *di; + + common_setup(argv[0]); + assert(chdir("tests/fuzz/corpora") == 0); + assert(chdir(path_basename(tmpctx, argv[0])) == 0); + + /* FIXME: Support explicit path args? */ + init(&argc, &argv); + d = opendir("."); + while ((di = readdir(d)) != NULL) { + u8 *contents; + if (streq(di->d_name, ".") || streq(di->d_name, "..")) + continue; + contents = grab_file(tmpctx, di->d_name); + assert(contents); + run(contents, tal_bytelen(contents)-1); + } + closedir(d); + common_shutdown(); +} + +/* We never call any functions which might call these */ +size_t LLVMFuzzerMutate(uint8_t *data, size_t size, size_t max_size); +size_t LLVMFuzzerMutate(uint8_t *data, size_t size, size_t max_size) +{ + abort(); +} +#endif /* !FUZZING */ diff --git a/tests/fuzz/libfuzz.h b/tests/fuzz/libfuzz.h index cd095035ac15..332caa3e8340 100644 --- a/tests/fuzz/libfuzz.h +++ b/tests/fuzz/libfuzz.h @@ -4,6 +4,7 @@ #include "config.h" #include #include +#include #include #include diff --git a/tests/fuzz/wire.h b/tests/fuzz/wire.h index 28a523064602..23d1ee1c1d27 100644 --- a/tests/fuzz/wire.h +++ b/tests/fuzz/wire.h @@ -21,7 +21,7 @@ static u8 *prefix_arr(const u8 *data, size_t size, u16 prefix) } /* The init function used by all fuzz-wire-* targets. */ -void init(int *argc, char ***argv) { common_setup("fuzzer"); } +void init(int *argc, char ***argv) { common_setup("fuzzer"); dev_towire_allow_invalid_node_id = true; } /* Test that decoding arbitrary data does not crash. Then, if the data was * successfully decoded, test that encoding and decoding the message does not diff --git a/tests/plugins/Makefile b/tests/plugins/Makefile index 826857db18a1..3a0c46851f3d 100644 --- a/tests/plugins/Makefile +++ b/tests/plugins/Makefile @@ -1,14 +1,14 @@ PLUGIN_TESTLIBPLUGIN_SRC := tests/plugins/test_libplugin.c PLUGIN_TESTLIBPLUGIN_OBJS := $(PLUGIN_TESTLIBPLUGIN_SRC:.c=.o) -tests/plugins/test_libplugin: bitcoin/chainparams.o $(PLUGIN_TESTLIBPLUGIN_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) +tests/plugins/test_libplugin: $(PLUGIN_TESTLIBPLUGIN_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a -$(PLUGIN_TESTLIBPLUGIN_OBJS): $(PLUGIN_LIB_HEADER) +$(PLUGIN_TESTLIBPLUGIN_OBJS): $(PLUGIN_LIB_HEADER) tests/plugins/Makefile PLUGIN_TESTSELFDISABLE_AFTER_GETMANIFEST_SRC := tests/plugins/test_selfdisable_after_getmanifest.c PLUGIN_TESTSELFDISABLE_AFTER_GETMANIFEST_OBJS := $(PLUGIN_TESTSELFDISABLE_AFTER_GETMANIFEST_SRC:.c=.o) -tests/plugins/test_selfdisable_after_getmanifest: bitcoin/chainparams.o $(PLUGIN_TESTSELFDISABLE_AFTER_GETMANIFEST_OBJS) common/autodata.o common/json_parse_simple.o common/setup.o common/utils.o $(JSMN_OBJS) +tests/plugins/test_selfdisable_after_getmanifest: $(PLUGIN_TESTSELFDISABLE_AFTER_GETMANIFEST_OBJS) libcommon.a PLUGIN_CHANNELD_FAKENET_SRC := tests/plugins/channeld_fakenet.c PLUGIN_CHANNELD_FAKENET_OBJS := $(PLUGIN_CHANNELD_FAKENET_SRC:.c=.o) @@ -17,85 +17,9 @@ tests/plugins/channeld_fakenet: \ $(PLUGIN_CHANNELD_FAKENET_OBJS) \ channeld/channeld_wiregen.o \ channeld/commit_tx.o \ - bitcoin/block.o \ - bitcoin/chainparams.o \ - bitcoin/pubkey.o \ - bitcoin/short_channel_id.o \ - bitcoin/locktime.o \ - bitcoin/preimage.o \ - bitcoin/privkey.o \ - bitcoin/psbt.o \ - bitcoin/signature.o \ - bitcoin/tx.o \ - bitcoin/script.o \ - bitcoin/shadouble.o \ - bitcoin/varint.o \ channeld/full_channel.o \ channeld/inflight.o \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/bigsize.o \ - common/billboard.o \ - common/bip32.o \ - common/blinding.o \ - common/blindedpath.o \ - common/blockheight_states.o \ - common/channel_config.o \ - common/channel_id.o \ - common/channel_type.o \ - common/daemon.o \ - common/daemon_conn.o \ - common/derive_basepoints.o \ - common/features.o \ - common/fee_states.o \ - common/peer_io.o \ - common/peer_status_wiregen.o \ - common/status_wiregen.o \ - common/gossip_store.o \ - common/gossmap.o \ - common/hmac.o \ - common/htlc_state.o \ - common/htlc_trim.o \ - common/htlc_tx.o \ - common/htlc_wire.o \ - common/initial_channel.o \ - common/initial_commit_tx.o \ - common/keyset.o \ - common/key_derive.o \ - common/memleak.o \ - common/msg_queue.o \ - common/node_id.o \ - common/onion_decode.o \ - common/onionreply.o \ - common/peer_billboard.o \ - common/peer_failed.o \ - common/penalty_base.o \ - common/per_peer_state.o \ - common/permute_tx.o \ - common/pseudorand.o \ - common/setup.o \ - common/sphinx.o \ - common/status.o \ - common/status_wire.o \ - common/subdaemon.o \ - common/timeout.o \ - common/utils.o \ - common/version.o \ - common/wire_error.o \ - common/wireaddr.o \ - common/fp16.o \ - common/sciddir_or_pubkey.o \ - wire/fromwire.o \ - wire/wire_io.o \ - wire/peer_wire.o \ - wire/peer_wiregen.o \ - wire/onion_wiregen.o \ - wire/towire.o \ - wire/channel_type_wiregen.o \ - wire/tlvstream.o \ - wire/wire_sync.o - + libcommon.a # Make sure these depend on everything. ALL_TEST_PROGRAMS += tests/plugins/test_libplugin tests/plugins/test_selfdisable_after_getmanifest tests/plugins/channeld_fakenet diff --git a/tests/plugins/channeld_fakenet.c b/tests/plugins/channeld_fakenet.c index fc08d2bf1352..d56c5824fb01 100644 --- a/tests/plugins/channeld_fakenet.c +++ b/tests/plugins/channeld_fakenet.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/tools/Makefile b/tools/Makefile index 6b92ebdd5555..932ed45ea838 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -8,17 +8,14 @@ ALL_C_SOURCES += $(TOOLS_SRC) ALL_C_HEADERS += ALL_PROGRAMS += $(TOOLS) -TOOLS_COMMON_OBJS = common/utils.o - # We force make to relink this every time, to detect version changes. # Do it atomically, otherwise parallel builds can get upset! tools/headerversions: $(FORCE) tools/headerversions.o libccan.a @trap "rm -f $@.tmp.$$$$" EXIT; $(LINK.o) tools/headerversions.o libccan.a $(LOADLIBES) $(LDLIBS) -o $@.tmp.$$$$ && mv -f $@.tmp.$$$$ $@ tools/headerversions.o: ccan/config.h -tools/check-bolt: tools/check-bolt.o $(TOOLS_COMMON_OBJS) - -tools/hsmtool: tools/hsmtool.o $(TOOLS_COMMON_OBJS) $(BITCOIN_OBJS) common/amount.o common/autodata.o common/bech32.o common/bech32_util.o common/bigsize.o common/codex32.o common/configdir.o common/configvar.o common/derive_basepoints.o common/descriptor_checksum.o common/hsm_encryption.o common/key_derive.o common/node_id.o common/version.o wire/fromwire.o wire/towire.o +tools/check-bolt: tools/check-bolt.o libcommon.a +tools/hsmtool: tools/hsmtool.o libcommon.a tools/lightning-hsmtool: tools/hsmtool cp $< $@ diff --git a/tools/hsmtool.c b/tools/hsmtool.c index 7f2d30fb9d59..1352bd807207 100644 --- a/tools/hsmtool.c +++ b/tools/hsmtool.c @@ -1,5 +1,4 @@ #include "config.h" -#include #include #include #include @@ -12,18 +11,17 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/tools/test/Makefile b/tools/test/Makefile index 9556f3be96ac..edb272de2431 100644 --- a/tools/test/Makefile +++ b/tools/test/Makefile @@ -22,16 +22,11 @@ TOOL_TEST_PROGRAMS := $(TOOL_TEST_OBJS:.o=) ALL_C_SOURCES += $(TOOL_GEN_SRC) $(TOOL_TEST_SRC) ALL_C_HEADERS += $(TOOL_GEN_HEADER) -TOOL_TEST_COMMON_OBJS := \ - common/utils.o \ - wire/fromwire.o \ - wire/towire.o - TOOLS_WIRE_DEPS := $(BOLT_DEPS) tools/test/test_cases $(wildcard tools/gen/*_template) tools/test/enum.o: ccan/config.h -$(TOOL_TEST_OBJS) $(TOOL_GEN_OBJS): $(TOOL_GEN_HEADER) -$(TOOL_TEST_PROGRAMS): $(TOOL_TEST_COMMON_OBJS) $(TOOL_GEN_OBJS) tools/test/enum.o +$(TOOL_TEST_OBJS) $(TOOL_GEN_OBJS): $(TOOL_GEN_HEADER) tools/test/Makefile +$(TOOL_TEST_PROGRAMS): $(TOOL_GEN_OBJS) tools/test/enum.o libcommon.a tools/test/test_gen.h: $(TOOLS_WIRE_DEPS) tools/test/Makefile $(BOLT_GEN) --page header $@ test_type < tools/test/test_cases > $@ diff --git a/tools/test/run-test-wire.c b/tools/test/run-test-wire.c index 7e3365e8efac..7d6da43ac440 100644 --- a/tools/test/run-test-wire.c +++ b/tools/test/run-test-wire.c @@ -10,15 +10,6 @@ /* AUTOGENERATED MOCKS START */ -/* Generated stub for fromwire_amount_msat */ -struct amount_msat fromwire_amount_msat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_amount_msat 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, - void *record UNNEEDED, struct tlv_field **fields UNNEEDED, - const u64 *extra_types UNNEEDED, size_t *err_off UNNEEDED, u64 *err_type UNNEEDED) -{ fprintf(stderr, "fromwire_tlv called!\n"); abort(); } /* Generated stub for printwire_amount_msat */ bool printwire_amount_msat(const char *fieldname UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED) { fprintf(stderr, "printwire_amount_msat called!\n"); abort(); } @@ -56,14 +47,6 @@ bool printwire_u64(const char *fieldname UNNEEDED, const u8 **cursor UNNEEDED, s /* Generated stub for printwire_u8_array */ bool printwire_u8_array(const char *fieldname UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED, size_t len UNNEEDED) { fprintf(stderr, "printwire_u8_array called!\n"); abort(); } -/* Generated stub for towire_amount_msat */ -void towire_amount_msat(u8 **pptr UNNEEDED, const struct amount_msat msat UNNEEDED) -{ fprintf(stderr, "towire_amount_msat 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, - const void *record UNNEEDED) -{ fprintf(stderr, "towire_tlv called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ #define COMPARE_VALS(type, len) \ diff --git a/wallet/account_migration.c b/wallet/account_migration.c index 60e5bced70ba..3e5bbe1d0814 100644 --- a/wallet/account_migration.c +++ b/wallet/account_migration.c @@ -9,9 +9,7 @@ #include #include #include -#include #include -#include /* These functions and definitions copied almost exactly from old * plugins/bkpr/{recorder.c,chain_event.h,channel_event.h} diff --git a/wallet/db.c b/wallet/db.c index eb0ae7bed94e..2457349613f5 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -1,11 +1,7 @@ #include "config.h" #include #include -#include -#include #include -#include -#include #include #include #include @@ -16,12 +12,9 @@ #include #include #include -#include -#include #include #include #include -#include #include struct migration { diff --git a/wallet/invoices.c b/wallet/invoices.c index 1655c8f96f85..0376f179cef6 100644 --- a/wallet/invoices.c +++ b/wallet/invoices.c @@ -7,7 +7,6 @@ #include #include #include -#include #include struct invoice_waiter { diff --git a/wallet/psbt_fixup.c b/wallet/psbt_fixup.c index b5509635d201..1c15946ceb5f 100644 --- a/wallet/psbt_fixup.c +++ b/wallet/psbt_fixup.c @@ -6,11 +6,8 @@ * As of libwally 0.88 (and perhaps 0.87?) it will refuse to load them. */ #include "config.h" -#include #include -#include #include -#include #include #include #include diff --git a/wallet/reservation.c b/wallet/reservation.c index 9c100a0cc4bb..dd1bebb294a8 100644 --- a/wallet/reservation.c +++ b/wallet/reservation.c @@ -3,19 +3,15 @@ #include #include #include -#include -#include #include -#include -#include #include #include #include +#include #include #include #include #include -#include /* 12 hours is usually enough reservation time */ #define RESERVATION_DEFAULT (6 * 12) diff --git a/wallet/test/Makefile b/wallet/test/Makefile index c986342dfbcf..65869c5c6082 100644 --- a/wallet/test/Makefile +++ b/wallet/test/Makefile @@ -5,39 +5,7 @@ WALLET_TEST_PROGRAMS := $(WALLET_TEST_OBJS:.o=) ALL_C_SOURCES += $(WALLET_TEST_SRC) ALL_TEST_PROGRAMS += $(WALLET_TEST_PROGRAMS) -WALLET_TEST_COMMON_OBJS := \ - common/amount.o \ - common/autodata.o \ - common/base32.o \ - common/blockheight_states.o \ - common/channel_id.o \ - common/channel_type.o \ - common/derive_basepoints.o \ - common/features.o \ - common/htlc_state.o \ - common/hsm_capable.o \ - common/htlc_wire.o \ - common/fee_states.o \ - common/memleak.o \ - common/node_id.o \ - common/onionreply.o \ - common/key_derive.o \ - common/psbt_keypath.o \ - common/pseudorand.o \ - common/setup.o \ - common/timeout.o \ - common/trace.o \ - common/utils.o \ - common/utxo.o \ - common/wireaddr.o \ - common/version.o \ - common/bigsize.o \ - wallet/db_sqlite3_sqlgen.o \ - wire/towire.o \ - wire/fromwire.o \ - wire/tlvstream.o - -$(WALLET_TEST_PROGRAMS): $(BITCOIN_OBJS) $(WALLET_TEST_COMMON_OBJS) -$(WALLET_TEST_OBJS): $(WALLET_HDRS) $(WALLET_SRC) +$(WALLET_TEST_PROGRAMS): wallet/db_sqlite3_sqlgen.o libcommon.a +$(WALLET_TEST_OBJS): $(WALLET_HDRS) $(WALLET_SRC) wallet/test/Makefile check-units: $(WALLET_TEST_PROGRAMS:%=unittest/%) diff --git a/wallet/test/run-chain_moves_duplicate-detect.c b/wallet/test/run-chain_moves_duplicate-detect.c index fdf62145e64a..3a7134f797ad 100644 --- a/wallet/test/run-chain_moves_duplicate-detect.c +++ b/wallet/test/run-chain_moves_duplicate-detect.c @@ -67,11 +67,6 @@ void connect_htlc_in(struct htlc_in_map *map UNNEEDED, struct htlc_in *hin UNNEE /* Generated stub for connect_htlc_out */ void connect_htlc_out(struct htlc_out_map *map UNNEEDED, struct htlc_out *hout UNNEEDED) { fprintf(stderr, "connect_htlc_out called!\n"); abort(); } -/* Generated stub for create_onionreply */ -struct onionreply *create_onionreply(const tal_t *ctx UNNEEDED, - const struct secret *shared_secret UNNEEDED, - const u8 *failure_msg UNNEEDED) -{ fprintf(stderr, "create_onionreply called!\n"); abort(); } /* Generated stub for fatal */ void fatal(const char *fmt UNNEEDED, ...) { fprintf(stderr, "fatal called!\n"); abort(); } @@ -302,9 +297,6 @@ void notify_forward_event(struct lightningd *ld UNNEEDED, u64 created_index UNNEEDED, u64 updated_index UNNEEDED) { fprintf(stderr, "notify_forward_event called!\n"); abort(); } -/* Generated stub for onion_wire_name */ -const char *onion_wire_name(int e UNNEEDED) -{ fprintf(stderr, "onion_wire_name called!\n"); abort(); } /* Generated stub for outpointfilter_add */ void outpointfilter_add(struct outpointfilter *of UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED) @@ -354,18 +346,12 @@ u64 sendpay_index_update_status(struct lightningd *ld UNNEEDED, u64 groupid UNNEEDED, enum payment_status status UNNEEDED) { fprintf(stderr, "sendpay_index_update_status called!\n"); abort(); } -/* Generated stub for to_canonical_invstr */ -const char *to_canonical_invstr(const tal_t *ctx UNNEEDED, const char *invstring UNNEEDED) -{ fprintf(stderr, "to_canonical_invstr called!\n"); abort(); } /* Generated stub for towire_hsmd_get_channel_basepoints */ u8 *towire_hsmd_get_channel_basepoints(const tal_t *ctx UNNEEDED, const struct node_id *peerid UNNEEDED, u64 dbid UNNEEDED) { fprintf(stderr, "towire_hsmd_get_channel_basepoints called!\n"); abort(); } /* Generated stub for towire_hsmd_get_output_scriptpubkey */ u8 *towire_hsmd_get_output_scriptpubkey(const tal_t *ctx UNNEEDED, u64 channel_id UNNEEDED, const struct node_id *peer_id UNNEEDED, const struct pubkey *commitment_point UNNEEDED) { fprintf(stderr, "towire_hsmd_get_output_scriptpubkey called!\n"); abort(); } -/* Generated stub for towire_temporary_node_failure */ -u8 *towire_temporary_node_failure(const tal_t *ctx UNNEEDED) -{ fprintf(stderr, "towire_temporary_node_failure called!\n"); abort(); } /* Generated stub for txfilter_add_scriptpubkey */ void txfilter_add_scriptpubkey(struct txfilter *filter UNNEEDED, const u8 *script TAKES UNNEEDED) { fprintf(stderr, "txfilter_add_scriptpubkey called!\n"); abort(); } @@ -375,12 +361,6 @@ const char *wait_index_name(enum wait_index index UNNEEDED) /* Generated stub for wait_subsystem_name */ const char *wait_subsystem_name(enum wait_subsystem subsystem UNNEEDED) { fprintf(stderr, "wait_subsystem_name called!\n"); abort(); } -/* Generated stub for wire_sync_read */ -u8 *wire_sync_read(const tal_t *ctx UNNEEDED, int fd UNNEEDED) -{ fprintf(stderr, "wire_sync_read called!\n"); abort(); } -/* Generated stub for wire_sync_write */ -bool wire_sync_write(int fd UNNEEDED, const void *msg TAKES UNNEEDED) -{ fprintf(stderr, "wire_sync_write called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ void plugin_hook_db_sync(struct db *db UNNEEDED) diff --git a/wallet/test/run-db.c b/wallet/test/run-db.c index 106cd38026ae..1c71c42699e9 100644 --- a/wallet/test/run-db.c +++ b/wallet/test/run-db.c @@ -71,11 +71,6 @@ void connect_htlc_in(struct htlc_in_map *map UNNEEDED, struct htlc_in *hin UNNEE /* Generated stub for connect_htlc_out */ void connect_htlc_out(struct htlc_out_map *map UNNEEDED, struct htlc_out *hout UNNEEDED) { fprintf(stderr, "connect_htlc_out called!\n"); abort(); } -/* Generated stub for create_onionreply */ -struct onionreply *create_onionreply(const tal_t *ctx UNNEEDED, - const struct secret *shared_secret UNNEEDED, - const u8 *failure_msg UNNEEDED) -{ fprintf(stderr, "create_onionreply called!\n"); abort(); } /* Generated stub for fatal */ void fatal(const char *fmt UNNEEDED, ...) { fprintf(stderr, "fatal called!\n"); abort(); } @@ -174,12 +169,6 @@ void logv(struct logger *logger UNNEEDED, enum log_level level UNNEEDED, const s void memleak_scan_outpointfilter(struct htable *memtable UNNEEDED, const struct outpointfilter *opf UNNEEDED) { fprintf(stderr, "memleak_scan_outpointfilter called!\n"); abort(); } -/* Generated stub for mk_mvt_tags_ */ -struct mvt_tags mk_mvt_tags_(enum mvt_tag tag UNNEEDED, ...) -{ fprintf(stderr, "mk_mvt_tags_ called!\n"); abort(); } -/* Generated stub for mvt_tags_valid */ -bool mvt_tags_valid(struct mvt_tags tags UNNEEDED) -{ fprintf(stderr, "mvt_tags_valid called!\n"); abort(); } /* Generated stub for new_channel */ struct channel *new_channel(struct peer *peer UNNEEDED, u64 dbid UNNEEDED, /* NULL or stolen */ @@ -256,19 +245,6 @@ struct channel *new_channel(struct peer *peer UNNEEDED, u64 dbid UNNEEDED, const struct channel_stats *stats UNNEEDED, struct channel_state_change **state_changes STEALS UNNEEDED) { fprintf(stderr, "new_channel called!\n"); abort(); } -/* Generated stub for new_channel_coin_mvt_general */ -struct channel_coin_mvt *new_channel_coin_mvt_general(const tal_t *ctx UNNEEDED, - const struct channel *channel UNNEEDED, - const struct channel_id *cid UNNEEDED, - u64 timestamp UNNEEDED, - const struct sha256 *payment_hash TAKES UNNEEDED, - const u64 *part_id UNNEEDED, - const u64 *group_id UNNEEDED, - enum coin_mvt_dir direction UNNEEDED, - struct amount_msat amount UNNEEDED, - struct mvt_tags tags UNNEEDED, - struct amount_msat fees UNNEEDED) -{ fprintf(stderr, "new_channel_coin_mvt_general called!\n"); abort(); } /* Generated stub for new_channel_state_change */ struct channel_state_change *new_channel_state_change(const tal_t *ctx UNNEEDED, struct timeabs timestamp UNNEEDED, @@ -277,36 +253,6 @@ struct channel_state_change *new_channel_state_change(const tal_t *ctx UNNEEDED, enum state_change cause UNNEEDED, const char *message TAKES UNNEEDED) { fprintf(stderr, "new_channel_state_change called!\n"); abort(); } -/* Generated stub for new_coin_channel_open_general */ -struct chain_coin_mvt *new_coin_channel_open_general(const tal_t *ctx UNNEEDED, - const struct channel *channel UNNEEDED, - const struct channel_id *cid UNNEEDED, - u64 timestamp UNNEEDED, - const struct bitcoin_outpoint *out UNNEEDED, - const struct node_id *peer_id UNNEEDED, - u32 blockheight UNNEEDED, - const struct amount_msat amount UNNEEDED, - const struct amount_sat output_val UNNEEDED, - bool is_opener UNNEEDED, - bool is_leased UNNEEDED) -{ fprintf(stderr, "new_coin_channel_open_general called!\n"); abort(); } -/* Generated stub for new_coin_channel_push_general */ -struct channel_coin_mvt *new_coin_channel_push_general(const tal_t *ctx UNNEEDED, - const struct channel *channel UNNEEDED, - const struct channel_id *cid UNNEEDED, - u64 timestamp UNNEEDED, - enum coin_mvt_dir direction UNNEEDED, - struct amount_msat amount UNNEEDED, - struct mvt_tags tags UNNEEDED) -{ fprintf(stderr, "new_coin_channel_push_general called!\n"); abort(); } -/* Generated stub for new_coin_wallet_deposit */ -struct chain_coin_mvt *new_coin_wallet_deposit(const tal_t *ctx UNNEEDED, - const struct bitcoin_outpoint *outpoint UNNEEDED, - u32 blockheight UNNEEDED, - struct amount_sat amount UNNEEDED, - struct mvt_tags tags) - -{ fprintf(stderr, "new_coin_wallet_deposit called!\n"); abort(); } /* Generated stub for new_inflight */ struct channel_inflight *new_inflight(struct channel *channel UNNEEDED, struct pubkey *remote_funding STEALS UNNEEDED, @@ -364,9 +310,6 @@ void notify_forward_event(struct lightningd *ld UNNEEDED, u64 created_index UNNEEDED, u64 updated_index UNNEEDED) { fprintf(stderr, "notify_forward_event called!\n"); abort(); } -/* Generated stub for onion_wire_name */ -const char *onion_wire_name(int e UNNEEDED) -{ fprintf(stderr, "onion_wire_name called!\n"); abort(); } /* Generated stub for outpointfilter_add */ void outpointfilter_add(struct outpointfilter *of UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED) @@ -385,9 +328,6 @@ void outpointfilter_remove(struct outpointfilter *of UNNEEDED, /* Generated stub for peer_set_dbid */ void peer_set_dbid(struct peer *peer UNNEEDED, u64 dbid UNNEEDED) { fprintf(stderr, "peer_set_dbid called!\n"); abort(); } -/* Generated stub for primary_mvt_tag */ -enum mvt_tag primary_mvt_tag(struct mvt_tags tags UNNEEDED) -{ fprintf(stderr, "primary_mvt_tag called!\n"); abort(); } /* Generated stub for psbt_fixup */ const u8 *psbt_fixup(const tal_t *ctx UNNEEDED, const u8 *psbtblob UNNEEDED) { fprintf(stderr, "psbt_fixup called!\n"); abort(); } @@ -419,18 +359,12 @@ u64 sendpay_index_update_status(struct lightningd *ld UNNEEDED, u64 groupid UNNEEDED, enum payment_status status UNNEEDED) { fprintf(stderr, "sendpay_index_update_status called!\n"); abort(); } -/* Generated stub for to_canonical_invstr */ -const char *to_canonical_invstr(const tal_t *ctx UNNEEDED, const char *invstring UNNEEDED) -{ fprintf(stderr, "to_canonical_invstr called!\n"); abort(); } /* Generated stub for towire_hsmd_get_channel_basepoints */ u8 *towire_hsmd_get_channel_basepoints(const tal_t *ctx UNNEEDED, const struct node_id *peerid UNNEEDED, u64 dbid UNNEEDED) { fprintf(stderr, "towire_hsmd_get_channel_basepoints called!\n"); abort(); } /* Generated stub for towire_hsmd_get_output_scriptpubkey */ u8 *towire_hsmd_get_output_scriptpubkey(const tal_t *ctx UNNEEDED, u64 channel_id UNNEEDED, const struct node_id *peer_id UNNEEDED, const struct pubkey *commitment_point UNNEEDED) { fprintf(stderr, "towire_hsmd_get_output_scriptpubkey called!\n"); abort(); } -/* Generated stub for towire_temporary_node_failure */ -u8 *towire_temporary_node_failure(const tal_t *ctx UNNEEDED) -{ fprintf(stderr, "towire_temporary_node_failure called!\n"); abort(); } /* Generated stub for txfilter_add_scriptpubkey */ void txfilter_add_scriptpubkey(struct txfilter *filter UNNEEDED, const u8 *script TAKES UNNEEDED) { fprintf(stderr, "txfilter_add_scriptpubkey called!\n"); abort(); } @@ -440,12 +374,6 @@ const char *wait_index_name(enum wait_index index UNNEEDED) /* Generated stub for wait_subsystem_name */ const char *wait_subsystem_name(enum wait_subsystem subsystem UNNEEDED) { fprintf(stderr, "wait_subsystem_name called!\n"); abort(); } -/* Generated stub for wire_sync_read */ -u8 *wire_sync_read(const tal_t *ctx UNNEEDED, int fd UNNEEDED) -{ fprintf(stderr, "wire_sync_read called!\n"); abort(); } -/* Generated stub for wire_sync_write */ -bool wire_sync_write(int fd UNNEEDED, const void *msg TAKES UNNEEDED) -{ fprintf(stderr, "wire_sync_write called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ void plugin_hook_db_sync(struct db *db UNNEEDED) diff --git a/wallet/test/run-migrate_remove_chain_moves_duplicates.c b/wallet/test/run-migrate_remove_chain_moves_duplicates.c index f9ed9699df27..62b4606308bc 100644 --- a/wallet/test/run-migrate_remove_chain_moves_duplicates.c +++ b/wallet/test/run-migrate_remove_chain_moves_duplicates.c @@ -75,11 +75,6 @@ void connect_htlc_in(struct htlc_in_map *map UNNEEDED, struct htlc_in *hin UNNEE /* Generated stub for connect_htlc_out */ void connect_htlc_out(struct htlc_out_map *map UNNEEDED, struct htlc_out *hout UNNEEDED) { fprintf(stderr, "connect_htlc_out called!\n"); abort(); } -/* Generated stub for create_onionreply */ -struct onionreply *create_onionreply(const tal_t *ctx UNNEEDED, - const struct secret *shared_secret UNNEEDED, - const u8 *failure_msg UNNEEDED) -{ fprintf(stderr, "create_onionreply called!\n"); abort(); } /* Generated stub for fatal */ void fatal(const char *fmt UNNEEDED, ...) { fprintf(stderr, "fatal called!\n"); abort(); } @@ -322,9 +317,6 @@ void notify_forward_event(struct lightningd *ld UNNEEDED, u64 created_index UNNEEDED, u64 updated_index UNNEEDED) { fprintf(stderr, "notify_forward_event called!\n"); abort(); } -/* Generated stub for onion_wire_name */ -const char *onion_wire_name(int e UNNEEDED) -{ fprintf(stderr, "onion_wire_name called!\n"); abort(); } /* Generated stub for outpointfilter_add */ void outpointfilter_add(struct outpointfilter *of UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED) @@ -377,18 +369,12 @@ u64 sendpay_index_update_status(struct lightningd *ld UNNEEDED, u64 groupid UNNEEDED, enum payment_status status UNNEEDED) { fprintf(stderr, "sendpay_index_update_status called!\n"); abort(); } -/* Generated stub for to_canonical_invstr */ -const char *to_canonical_invstr(const tal_t *ctx UNNEEDED, const char *invstring UNNEEDED) -{ fprintf(stderr, "to_canonical_invstr called!\n"); abort(); } /* Generated stub for towire_hsmd_get_channel_basepoints */ u8 *towire_hsmd_get_channel_basepoints(const tal_t *ctx UNNEEDED, const struct node_id *peerid UNNEEDED, u64 dbid UNNEEDED) { fprintf(stderr, "towire_hsmd_get_channel_basepoints called!\n"); abort(); } /* Generated stub for towire_hsmd_get_output_scriptpubkey */ u8 *towire_hsmd_get_output_scriptpubkey(const tal_t *ctx UNNEEDED, u64 channel_id UNNEEDED, const struct node_id *peer_id UNNEEDED, const struct pubkey *commitment_point UNNEEDED) { fprintf(stderr, "towire_hsmd_get_output_scriptpubkey called!\n"); abort(); } -/* Generated stub for towire_temporary_node_failure */ -u8 *towire_temporary_node_failure(const tal_t *ctx UNNEEDED) -{ fprintf(stderr, "towire_temporary_node_failure called!\n"); abort(); } /* Generated stub for txfilter_add_scriptpubkey */ void txfilter_add_scriptpubkey(struct txfilter *filter UNNEEDED, const u8 *script TAKES UNNEEDED) { fprintf(stderr, "txfilter_add_scriptpubkey called!\n"); abort(); } @@ -398,12 +384,6 @@ const char *wait_index_name(enum wait_index index UNNEEDED) /* Generated stub for wait_subsystem_name */ const char *wait_subsystem_name(enum wait_subsystem subsystem UNNEEDED) { fprintf(stderr, "wait_subsystem_name called!\n"); abort(); } -/* Generated stub for wire_sync_read */ -u8 *wire_sync_read(const tal_t *ctx UNNEEDED, int fd UNNEEDED) -{ fprintf(stderr, "wire_sync_read called!\n"); abort(); } -/* Generated stub for wire_sync_write */ -bool wire_sync_write(int fd UNNEEDED, const void *msg TAKES UNNEEDED) -{ fprintf(stderr, "wire_sync_write called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ static const char *setup_stmts[] = { SQL("CREATE TABLE vars (" diff --git a/wallet/test/run-psbt_fixup.c b/wallet/test/run-psbt_fixup.c index ac63f25bb368..5af0ad531a0f 100644 --- a/wallet/test/run-psbt_fixup.c +++ b/wallet/test/run-psbt_fixup.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c index 5a6ad596c3b7..6371dfb263db 100644 --- a/wallet/test/run-wallet.c +++ b/wallet/test/run-wallet.c @@ -40,6 +40,7 @@ static void test_error(struct lightningd *ld, bool fatal, const char *fmt, va_li #include #include #include +#include /* AUTOGENERATED MOCKS START */ /* Generated stub for add_node_announcement_sig */ @@ -66,23 +67,6 @@ void bitcoind_getutxout_(const tal_t *ctx UNNEEDED, void *) UNNEEDED, void *arg UNNEEDED) { fprintf(stderr, "bitcoind_getutxout_ called!\n"); abort(); } -/* Generated stub for blinding_hash_e_and_ss */ -void blinding_hash_e_and_ss(const struct pubkey *e UNNEEDED, - const struct secret *ss UNNEEDED, - struct sha256 *sha UNNEEDED) -{ fprintf(stderr, "blinding_hash_e_and_ss called!\n"); abort(); } -/* Generated stub for blinding_next_path_key */ -bool blinding_next_path_key(const struct pubkey *pk UNNEEDED, - const struct sha256 *h UNNEEDED, - struct pubkey *next UNNEEDED) -{ fprintf(stderr, "blinding_next_path_key called!\n"); abort(); } -/* Generated stub for bolt11_decode */ -struct bolt11 *bolt11_decode(const tal_t *ctx UNNEEDED, const char *str UNNEEDED, - const struct feature_set *our_features UNNEEDED, - const char *description UNNEEDED, - const struct chainparams *must_be_chain UNNEEDED, - char **fail UNNEEDED) -{ fprintf(stderr, "bolt11_decode called!\n"); abort(); } /* Generated stub for broadcast_tx_ */ void broadcast_tx_(const tal_t *ctx UNNEEDED, struct chain_topology *topo UNNEEDED, @@ -152,36 +136,49 @@ struct command_result *command_check_done(struct command *cmd) /* Generated stub for command_check_only */ bool command_check_only(const struct command *cmd UNNEEDED) { fprintf(stderr, "command_check_only called!\n"); abort(); } +/* Generated stub for command_deprecated_in_ok */ +bool command_deprecated_in_ok(struct command *cmd UNNEEDED, + const char *param UNNEEDED, + const char *depr_start UNNEEDED, + const char *depr_end UNNEEDED) +{ fprintf(stderr, "command_deprecated_in_ok called!\n"); abort(); } /* Generated stub for command_deprecated_out_ok */ bool command_deprecated_out_ok(struct command *cmd UNNEEDED, const char *fieldname UNNEEDED, const char *depr_start UNNEEDED, const char *depr_end UNNEEDED) { fprintf(stderr, "command_deprecated_out_ok called!\n"); abort(); } +/* Generated stub for command_dev_apis */ +bool command_dev_apis(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_dev_apis called!\n"); abort(); } /* Generated stub for command_fail */ struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, const char *fmt UNNEEDED, ...) { fprintf(stderr, "command_fail called!\n"); abort(); } -/* Generated stub for command_fail_badparam */ -struct command_result *command_fail_badparam(struct command *cmd UNNEEDED, - const char *paramname UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - const char *msg UNNEEDED) -{ fprintf(stderr, "command_fail_badparam called!\n"); abort(); } /* Generated stub for command_failed */ struct command_result *command_failed(struct command *cmd UNNEEDED, struct json_stream *result) { fprintf(stderr, "command_failed called!\n"); abort(); } +/* Generated stub for command_filter_ptr */ +struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_filter_ptr called!\n"); abort(); } /* Generated stub for command_its_complicated */ struct command_result *command_its_complicated(const char *why UNNEEDED) { fprintf(stderr, "command_its_complicated called!\n"); abort(); } +/* Generated stub for command_log */ +void command_log(struct command *cmd UNNEEDED, enum log_level level UNNEEDED, + const char *fmt UNNEEDED, ...) + +{ fprintf(stderr, "command_log called!\n"); abort(); } /* Generated stub for command_param_failed */ struct command_result *command_param_failed(void) { fprintf(stderr, "command_param_failed called!\n"); abort(); } +/* Generated stub for command_set_usage */ +void command_set_usage(struct command *cmd UNNEEDED, const char *usage UNNEEDED) +{ fprintf(stderr, "command_set_usage called!\n"); abort(); } /* Generated stub for command_still_pending */ struct command_result *command_still_pending(struct command *cmd) @@ -191,6 +188,9 @@ struct command_result *command_success(struct command *cmd UNNEEDED, struct json_stream *response) { fprintf(stderr, "command_success called!\n"); abort(); } +/* Generated stub for command_usage_only */ +bool command_usage_only(const struct command *cmd UNNEEDED) +{ fprintf(stderr, "command_usage_only called!\n"); abort(); } /* Generated stub for commit_tx_boost */ void commit_tx_boost(struct channel *channel UNNEEDED, struct anchor_details *adet UNNEEDED, @@ -229,19 +229,6 @@ u8 *create_channel_announcement(const tal_t *ctx UNNEEDED, const secp256k1_ecdsa_signature *remote_node_signature UNNEEDED, const secp256k1_ecdsa_signature *remote_bitcoin_signature UNNEEDED) { fprintf(stderr, "create_channel_announcement called!\n"); abort(); } -/* Generated stub for create_onionpacket */ -struct onionpacket *create_onionpacket( - const tal_t * ctx UNNEEDED, - struct sphinx_path *sp UNNEEDED, - size_t fixed_size UNNEEDED, - struct secret **path_secrets - ) -{ fprintf(stderr, "create_onionpacket called!\n"); abort(); } -/* Generated stub for create_onionreply */ -struct onionreply *create_onionreply(const tal_t *ctx UNNEEDED, - const struct secret *shared_secret UNNEEDED, - const u8 *failure_msg UNNEEDED) -{ fprintf(stderr, "create_onionreply called!\n"); abort(); } /* Generated stub for depthcb_update_scid */ bool depthcb_update_scid(struct channel *channel UNNEEDED, const struct bitcoin_txid *txid UNNEEDED, @@ -250,14 +237,6 @@ bool depthcb_update_scid(struct channel *channel UNNEEDED, /* Generated stub for dev_disconnect_permanent */ bool dev_disconnect_permanent(struct lightningd *ld UNNEEDED) { fprintf(stderr, "dev_disconnect_permanent called!\n"); abort(); } -/* Generated stub for ecdh */ -void ecdh(const struct pubkey *point UNNEEDED, struct secret *ss UNNEEDED) -{ fprintf(stderr, "ecdh called!\n"); abort(); } -/* Generated stub for encode_scriptpubkey_to_addr */ -char *encode_scriptpubkey_to_addr(const tal_t *ctx UNNEEDED, - const struct chainparams *chainparams UNNEEDED, - const u8 *scriptpubkey UNNEEDED) -{ fprintf(stderr, "encode_scriptpubkey_to_addr called!\n"); abort(); } /* Generated stub for fatal */ void fatal(const char *fmt UNNEEDED, ...) { fprintf(stderr, "fatal called!\n"); abort(); } @@ -293,9 +272,6 @@ u64 forward_index_update_status(struct lightningd *ld UNNEEDED, struct amount_msat in_amount UNNEEDED, const struct short_channel_id *out_channel UNNEEDED) { fprintf(stderr, "forward_index_update_status 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_channeld_dev_memleak_reply */ bool fromwire_channeld_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNEEDED) { fprintf(stderr, "fromwire_channeld_dev_memleak_reply called!\n"); abort(); } @@ -341,6 +317,9 @@ bool fromwire_hsmd_cupdate_sig_reply(const tal_t *ctx UNNEEDED, const void *p UN /* Generated stub for fromwire_hsmd_derive_secret_reply */ bool fromwire_hsmd_derive_secret_reply(const void *p UNNEEDED, struct secret *secret UNNEEDED) { fprintf(stderr, "fromwire_hsmd_derive_secret_reply called!\n"); abort(); } +/* Generated stub for fromwire_hsmd_ecdh_resp */ +bool fromwire_hsmd_ecdh_resp(const void *p UNNEEDED, struct secret *ss UNNEEDED) +{ fprintf(stderr, "fromwire_hsmd_ecdh_resp called!\n"); abort(); } /* Generated stub for fromwire_hsmd_forget_channel_reply */ bool fromwire_hsmd_forget_channel_reply(const void *p UNNEEDED) { fprintf(stderr, "fromwire_hsmd_forget_channel_reply called!\n"); abort(); } @@ -371,10 +350,6 @@ bool fromwire_onchaind_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNE /* Generated stub for fromwire_openingd_dev_memleak_reply */ bool fromwire_openingd_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNEEDED) { fprintf(stderr, "fromwire_openingd_dev_memleak_reply called!\n"); abort(); } -/* Generated stub for fromwire_tlv_update_add_htlc_tlvs */ -struct tlv_update_add_htlc_tlvs *fromwire_tlv_update_add_htlc_tlvs(const tal_t *ctx UNNEEDED, - const u8 **cursor UNNEEDED, size_t *max UNNEEDED) -{ fprintf(stderr, "fromwire_tlv_update_add_htlc_tlvs called!\n"); abort(); } /* Generated stub for get_network_blockheight */ u32 get_network_blockheight(const struct chain_topology *topo UNNEEDED) { fprintf(stderr, "get_network_blockheight called!\n"); abort(); } @@ -384,15 +359,6 @@ size_t hash_cid(const struct channel_id *cid UNNEEDED) /* Generated stub for hsmd_wire_name */ const char *hsmd_wire_name(int e UNNEEDED) { fprintf(stderr, "hsmd_wire_name called!\n"); abort(); } -/* Generated stub for htlc_is_trimmed */ -bool htlc_is_trimmed(enum side htlc_owner UNNEEDED, - struct amount_msat htlc_amount UNNEEDED, - u32 feerate_per_kw UNNEEDED, - struct amount_sat dust_limit UNNEEDED, - enum side side UNNEEDED, - bool option_anchor_outputs UNNEEDED, - bool option_anchors_zero_fee_htlc_tx UNNEEDED) -{ fprintf(stderr, "htlc_is_trimmed called!\n"); abort(); } /* Generated stub for htlc_set_add_ */ void htlc_set_add_(struct lightningd *ld UNNEEDED, struct logger *log UNNEEDED, @@ -412,13 +378,6 @@ const struct invoice_details *invoice_check_payment(const tal_t *ctx UNNEEDED, const struct secret *payment_secret UNNEEDED, const char **err UNNEEDED) { fprintf(stderr, "invoice_check_payment called!\n"); abort(); } -/* Generated stub for invoice_decode */ -struct tlv_invoice *invoice_decode(const tal_t *ctx UNNEEDED, - const char *b12 UNNEEDED, size_t b12len UNNEEDED, - const struct feature_set *our_features UNNEEDED, - const struct chainparams *must_be_chain UNNEEDED, - char **fail UNNEEDED) -{ fprintf(stderr, "invoice_decode called!\n"); abort(); } /* Generated stub for invoices_find_by_rhash */ bool invoices_find_by_rhash(struct invoices *invoices UNNEEDED, u64 *inv_dbid UNNEEDED, @@ -436,132 +395,12 @@ bool invoices_resolve(struct invoices *invoices UNNEEDED, const struct json_escape *label UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED) { fprintf(stderr, "invoices_resolve called!\n"); abort(); } -/* Generated stub for is_hsm_secret_encrypted */ -int is_hsm_secret_encrypted(const char *path UNNEEDED) -{ fprintf(stderr, "is_hsm_secret_encrypted called!\n"); abort(); } -/* Generated stub for json_add_address */ -void json_add_address(struct json_stream *response UNNEEDED, const char *fieldname UNNEEDED, - const struct wireaddr *addr UNNEEDED) -{ fprintf(stderr, "json_add_address called!\n"); abort(); } -/* Generated stub for json_add_address_internal */ -void json_add_address_internal(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct wireaddr_internal *addr UNNEEDED) -{ fprintf(stderr, "json_add_address_internal called!\n"); abort(); } -/* Generated stub for json_add_amount_msat */ -void json_add_amount_msat(struct json_stream *result UNNEEDED, - const char *msatfieldname UNNEEDED, - struct amount_msat msat) - -{ fprintf(stderr, "json_add_amount_msat called!\n"); abort(); } -/* Generated stub for json_add_amount_sat_msat */ -void json_add_amount_sat_msat(struct json_stream *result UNNEEDED, - const char *msatfieldname UNNEEDED, - struct amount_sat sat) - -{ fprintf(stderr, "json_add_amount_sat_msat called!\n"); abort(); } -/* Generated stub for json_add_bool */ -void json_add_bool(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - bool value UNNEEDED) -{ fprintf(stderr, "json_add_bool called!\n"); abort(); } -/* Generated stub for json_add_channel_id */ -void json_add_channel_id(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct channel_id *cid UNNEEDED) -{ fprintf(stderr, "json_add_channel_id called!\n"); abort(); } -/* Generated stub for json_add_channel_type */ -void json_add_channel_type(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct channel_type *channel_type UNNEEDED) -{ fprintf(stderr, "json_add_channel_type called!\n"); abort(); } -/* Generated stub for json_add_hex */ -void json_add_hex(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const void *data UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "json_add_hex called!\n"); abort(); } -/* Generated stub for json_add_hex_talarr */ -void json_add_hex_talarr(struct json_stream *result UNNEEDED, - const char *fieldname UNNEEDED, - const tal_t *data UNNEEDED) -{ fprintf(stderr, "json_add_hex_talarr called!\n"); abort(); } -/* Generated stub for json_add_jsonstr */ -void json_add_jsonstr(struct json_stream *js UNNEEDED, - const char *fieldname UNNEEDED, - const char *jsonstr UNNEEDED, - size_t jsonstrlen UNNEEDED) -{ fprintf(stderr, "json_add_jsonstr called!\n"); abort(); } /* Generated stub for json_add_log */ void json_add_log(struct json_stream *result UNNEEDED, const struct log_book *log_book UNNEEDED, const struct node_id *node_id UNNEEDED, enum log_level minlevel UNNEEDED) { fprintf(stderr, "json_add_log called!\n"); abort(); } -/* Generated stub for json_add_node_id */ -void json_add_node_id(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct node_id *id UNNEEDED) -{ fprintf(stderr, "json_add_node_id called!\n"); abort(); } -/* Generated stub for json_add_num */ -void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - unsigned int value UNNEEDED) -{ fprintf(stderr, "json_add_num called!\n"); abort(); } -/* Generated stub for json_add_preimage */ -void json_add_preimage(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const struct preimage *preimage UNNEEDED) -{ fprintf(stderr, "json_add_preimage called!\n"); abort(); } -/* Generated stub for json_add_pubkey */ -void json_add_pubkey(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct pubkey *key UNNEEDED) -{ fprintf(stderr, "json_add_pubkey called!\n"); abort(); } -/* Generated stub for json_add_s32 */ -void json_add_s32(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - int32_t value UNNEEDED) -{ fprintf(stderr, "json_add_s32 called!\n"); abort(); } -/* Generated stub for json_add_s64 */ -void json_add_s64(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - int64_t value UNNEEDED) -{ fprintf(stderr, "json_add_s64 called!\n"); abort(); } -/* Generated stub for json_add_secret */ -void json_add_secret(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - const struct secret *secret UNNEEDED) -{ fprintf(stderr, "json_add_secret called!\n"); abort(); } -/* Generated stub for json_add_sha256 */ -void json_add_sha256(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const struct sha256 *hash UNNEEDED) -{ fprintf(stderr, "json_add_sha256 called!\n"); abort(); } -/* Generated stub for json_add_short_channel_id */ -void json_add_short_channel_id(struct json_stream *response UNNEEDED, - const char *fieldname UNNEEDED, - struct short_channel_id id UNNEEDED) -{ fprintf(stderr, "json_add_short_channel_id called!\n"); abort(); } -/* Generated stub for json_add_string */ -void json_add_string(struct json_stream *js UNNEEDED, - const char *fieldname UNNEEDED, - const char *str TAKES UNNEEDED) -{ fprintf(stderr, "json_add_string called!\n"); abort(); } -/* Generated stub for json_add_timeiso */ -void json_add_timeiso(struct json_stream *result UNNEEDED, - const char *fieldname UNNEEDED, - struct timeabs time UNNEEDED) -{ fprintf(stderr, "json_add_timeiso called!\n"); abort(); } -/* Generated stub for json_add_tx */ -void json_add_tx(struct json_stream *result UNNEEDED, - const char *fieldname UNNEEDED, - const struct bitcoin_tx *tx UNNEEDED) -{ fprintf(stderr, "json_add_tx called!\n"); abort(); } -/* Generated stub for json_add_txid */ -void json_add_txid(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - const struct bitcoin_txid *txid UNNEEDED) -{ fprintf(stderr, "json_add_txid called!\n"); abort(); } -/* Generated stub for json_add_u32 */ -void json_add_u32(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - uint32_t value UNNEEDED) -{ fprintf(stderr, "json_add_u32 called!\n"); abort(); } -/* Generated stub for json_add_u64 */ -void json_add_u64(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, - uint64_t value UNNEEDED) -{ fprintf(stderr, "json_add_u64 called!\n"); abort(); } /* Generated stub for json_add_uncommitted_channel */ void json_add_uncommitted_channel(struct command *cmd UNNEEDED, struct json_stream *response UNNEEDED, @@ -574,29 +413,6 @@ void json_add_unsaved_channel(struct command *cmd UNNEEDED, const struct channel *channel UNNEEDED, const struct peer *peer UNNEEDED) { fprintf(stderr, "json_add_unsaved_channel called!\n"); abort(); } -/* Generated stub for json_array_end */ -void json_array_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_array_end called!\n"); abort(); } -/* Generated stub for json_array_start */ -void json_array_start(struct json_stream *js UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_array_start called!\n"); abort(); } -/* Generated stub for json_get_membern */ -const jsmntok_t *json_get_membern(const char *buffer UNNEEDED, - const jsmntok_t tok[] UNNEEDED, - const char *label UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "json_get_membern called!\n"); abort(); } -/* Generated stub for json_next */ -const jsmntok_t *json_next(const jsmntok_t *tok UNNEEDED) -{ fprintf(stderr, "json_next called!\n"); abort(); } -/* Generated stub for json_object_end */ -void json_object_end(struct json_stream *js UNNEEDED) -{ fprintf(stderr, "json_object_end called!\n"); abort(); } -/* Generated stub for json_object_start */ -void json_object_start(struct json_stream *ks UNNEEDED, const char *fieldname UNNEEDED) -{ fprintf(stderr, "json_object_start called!\n"); abort(); } -/* Generated stub for json_strdup */ -char *json_strdup(const tal_t *ctx UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED) -{ fprintf(stderr, "json_strdup called!\n"); abort(); } /* Generated stub for json_stream_fail */ struct json_stream *json_stream_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED, @@ -605,43 +421,6 @@ struct json_stream *json_stream_fail(struct command *cmd UNNEEDED, /* Generated stub for json_stream_success */ struct json_stream *json_stream_success(struct command *cmd UNNEEDED) { fprintf(stderr, "json_stream_success called!\n"); abort(); } -/* Generated stub for json_to_channel_id */ -bool json_to_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct channel_id *cid UNNEEDED) -{ fprintf(stderr, "json_to_channel_id called!\n"); abort(); } -/* Generated stub for json_to_msat */ -bool json_to_msat(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct amount_msat *msat UNNEEDED) -{ fprintf(stderr, "json_to_msat called!\n"); abort(); } -/* Generated stub for json_to_node_id */ -bool json_to_node_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct node_id *id UNNEEDED) -{ fprintf(stderr, "json_to_node_id called!\n"); abort(); } -/* Generated stub for json_to_number */ -bool json_to_number(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - unsigned int *num UNNEEDED) -{ fprintf(stderr, "json_to_number called!\n"); abort(); } -/* Generated stub for json_to_preimage */ -bool json_to_preimage(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, struct preimage *preimage UNNEEDED) -{ fprintf(stderr, "json_to_preimage called!\n"); abort(); } -/* Generated stub for json_to_short_channel_id */ -bool json_to_short_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct short_channel_id *scid UNNEEDED) -{ fprintf(stderr, "json_to_short_channel_id called!\n"); abort(); } -/* Generated stub for json_tok_bin_from_hex */ -u8 *json_tok_bin_from_hex(const tal_t *ctx UNNEEDED, const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED) -{ fprintf(stderr, "json_tok_bin_from_hex called!\n"); abort(); } -/* Generated stub for json_tok_channel_id */ -bool json_tok_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct channel_id *cid UNNEEDED) -{ fprintf(stderr, "json_tok_channel_id called!\n"); abort(); } -/* Generated stub for json_tok_full */ -const char *json_tok_full(const char *buffer UNNEEDED, const jsmntok_t *t UNNEEDED) -{ fprintf(stderr, "json_tok_full called!\n"); abort(); } -/* Generated stub for json_tok_strneq */ -bool json_tok_strneq(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - const char *str UNNEEDED, size_t len UNNEEDED) -{ fprintf(stderr, "json_tok_strneq called!\n"); abort(); } /* Generated stub for kill_uncommitted_channel */ void kill_uncommitted_channel(struct uncommitted_channel *uc UNNEEDED, const char *why UNNEEDED) @@ -658,25 +437,6 @@ void logv(struct logger *logger UNNEEDED, enum log_level level UNNEEDED, const s void memleak_scan_outpointfilter(struct htable *memtable UNNEEDED, const struct outpointfilter *opf UNNEEDED) { fprintf(stderr, "memleak_scan_outpointfilter called!\n"); abort(); } -/* Generated stub for mk_mvt_tags_ */ -struct mvt_tags mk_mvt_tags_(enum mvt_tag tag UNNEEDED, ...) -{ fprintf(stderr, "mk_mvt_tags_ called!\n"); abort(); } -/* Generated stub for mvt_tags_valid */ -bool mvt_tags_valid(struct mvt_tags tags UNNEEDED) -{ fprintf(stderr, "mvt_tags_valid called!\n"); abort(); } -/* Generated stub for new_channel_coin_mvt_general */ -struct channel_coin_mvt *new_channel_coin_mvt_general(const tal_t *ctx UNNEEDED, - const struct channel *channel UNNEEDED, - const struct channel_id *cid UNNEEDED, - u64 timestamp UNNEEDED, - const struct sha256 *payment_hash TAKES UNNEEDED, - const u64 *part_id UNNEEDED, - const u64 *group_id UNNEEDED, - enum coin_mvt_dir direction UNNEEDED, - struct amount_msat amount UNNEEDED, - struct mvt_tags tags UNNEEDED, - struct amount_msat fees UNNEEDED) -{ fprintf(stderr, "new_channel_coin_mvt_general called!\n"); abort(); } /* Generated stub for new_channel_mvt_invoice_hin */ struct channel_coin_mvt *new_channel_mvt_invoice_hin(const tal_t *ctx UNNEEDED, const struct htlc_in *hin UNNEEDED, @@ -697,36 +457,6 @@ struct channel_coin_mvt *new_channel_mvt_routed_hout(const tal_t *ctx UNNEEDED, const struct htlc_out *hout UNNEEDED, const struct channel *channel UNNEEDED) { fprintf(stderr, "new_channel_mvt_routed_hout called!\n"); abort(); } -/* Generated stub for new_coin_channel_open_general */ -struct chain_coin_mvt *new_coin_channel_open_general(const tal_t *ctx UNNEEDED, - const struct channel *channel UNNEEDED, - const struct channel_id *cid UNNEEDED, - u64 timestamp UNNEEDED, - const struct bitcoin_outpoint *out UNNEEDED, - const struct node_id *peer_id UNNEEDED, - u32 blockheight UNNEEDED, - const struct amount_msat amount UNNEEDED, - const struct amount_sat output_val UNNEEDED, - bool is_opener UNNEEDED, - bool is_leased UNNEEDED) -{ fprintf(stderr, "new_coin_channel_open_general called!\n"); abort(); } -/* Generated stub for new_coin_channel_push_general */ -struct channel_coin_mvt *new_coin_channel_push_general(const tal_t *ctx UNNEEDED, - const struct channel *channel UNNEEDED, - const struct channel_id *cid UNNEEDED, - u64 timestamp UNNEEDED, - enum coin_mvt_dir direction UNNEEDED, - struct amount_msat amount UNNEEDED, - struct mvt_tags tags UNNEEDED) -{ fprintf(stderr, "new_coin_channel_push_general called!\n"); abort(); } -/* Generated stub for new_coin_wallet_deposit */ -struct chain_coin_mvt *new_coin_wallet_deposit(const tal_t *ctx UNNEEDED, - const struct bitcoin_outpoint *outpoint UNNEEDED, - u32 blockheight UNNEEDED, - struct amount_sat amount UNNEEDED, - struct mvt_tags tags) - -{ fprintf(stderr, "new_coin_wallet_deposit called!\n"); abort(); } /* Generated stub for new_global_subd */ struct subd *new_global_subd(struct lightningd *ld UNNEEDED, const char *name UNNEEDED, @@ -816,34 +546,6 @@ enum watch_result onchaind_funding_spent(struct channel *channel UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, u32 blockheight UNNEEDED) { fprintf(stderr, "onchaind_funding_spent called!\n"); abort(); } -/* Generated stub for onion_decode */ -struct onion_payload *onion_decode(const tal_t *ctx UNNEEDED, - const struct route_step *rs UNNEEDED, - const struct pubkey *path_key UNNEEDED, - const u64 *accepted_extra_tlvs UNNEEDED, - struct amount_msat amount_in UNNEEDED, - u32 cltv_expiry UNNEEDED, - u64 *failtlvtype UNNEEDED, - size_t *failtlvpos UNNEEDED, - const char **explanation UNNEEDED) -{ fprintf(stderr, "onion_decode called!\n"); abort(); } -/* Generated stub for onion_final_hop */ -u8 *onion_final_hop(const tal_t *ctx UNNEEDED, - struct amount_msat forward UNNEEDED, - u32 outgoing_cltv UNNEEDED, - struct amount_msat total_msat UNNEEDED, - const struct secret *payment_secret UNNEEDED, - const u8 *payment_metadata UNNEEDED) -{ fprintf(stderr, "onion_final_hop called!\n"); abort(); } -/* Generated stub for onion_nonfinal_hop */ -u8 *onion_nonfinal_hop(const tal_t *ctx UNNEEDED, - const struct short_channel_id *scid UNNEEDED, - struct amount_msat forward UNNEEDED, - u32 outgoing_cltv UNNEEDED) -{ fprintf(stderr, "onion_nonfinal_hop called!\n"); abort(); } -/* Generated stub for onion_wire_name */ -const char *onion_wire_name(int e UNNEEDED) -{ fprintf(stderr, "onion_wire_name called!\n"); abort(); } /* Generated stub for outpointfilter_add */ void outpointfilter_add(struct outpointfilter *of UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED) @@ -859,49 +561,6 @@ struct outpointfilter *outpointfilter_new(tal_t *ctx UNNEEDED) void outpointfilter_remove(struct outpointfilter *of UNNEEDED, const struct bitcoin_outpoint *outpoint UNNEEDED) { fprintf(stderr, "outpointfilter_remove called!\n"); abort(); } -/* Generated stub for param */ -bool param(struct command *cmd UNNEEDED, const char *buffer UNNEEDED, - const jsmntok_t params[] UNNEEDED, ...) -{ fprintf(stderr, "param called!\n"); abort(); } -/* Generated stub for param_bin_from_hex */ -struct command_result *param_bin_from_hex(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - u8 **bin UNNEEDED) -{ fprintf(stderr, "param_bin_from_hex called!\n"); abort(); } -/* Generated stub for param_bool */ -struct command_result *param_bool(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - bool **b UNNEEDED) -{ fprintf(stderr, "param_bool called!\n"); abort(); } -/* Generated stub for param_channel_id */ -struct command_result *param_channel_id(struct command *cmd UNNEEDED, - const char *name UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - struct channel_id **cid UNNEEDED) -{ fprintf(stderr, "param_channel_id called!\n"); abort(); } -/* Generated stub for param_check */ -bool param_check(struct command *cmd UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t tokens[] UNNEEDED, ...) -{ fprintf(stderr, "param_check called!\n"); abort(); } -/* Generated stub for param_escaped_string */ -struct command_result *param_escaped_string(struct command *cmd UNNEEDED, - const char *name UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - const char **str UNNEEDED) -{ fprintf(stderr, "param_escaped_string called!\n"); abort(); } -/* Generated stub for param_hops_array */ -struct command_result *param_hops_array(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct sphinx_hop **hops UNNEEDED) -{ fprintf(stderr, "param_hops_array called!\n"); abort(); } -/* Generated stub for param_invstring */ -struct command_result *param_invstring(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char * buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - const char **str UNNEEDED) -{ fprintf(stderr, "param_invstring called!\n"); abort(); } /* Generated stub for param_loglevel */ struct command_result *param_loglevel(struct command *cmd UNNEEDED, const char *name UNNEEDED, @@ -909,72 +568,6 @@ struct command_result *param_loglevel(struct command *cmd UNNEEDED, const jsmntok_t *tok UNNEEDED, enum log_level **level UNNEEDED) { fprintf(stderr, "param_loglevel called!\n"); abort(); } -/* Generated stub for param_msat */ -struct command_result *param_msat(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct amount_msat **msat UNNEEDED) -{ fprintf(stderr, "param_msat called!\n"); abort(); } -/* Generated stub for param_node_id */ -struct command_result *param_node_id(struct command *cmd UNNEEDED, - const char *name UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - struct node_id **id UNNEEDED) -{ fprintf(stderr, "param_node_id called!\n"); abort(); } -/* Generated stub for param_number */ -struct command_result *param_number(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - unsigned int **num UNNEEDED) -{ fprintf(stderr, "param_number called!\n"); abort(); } -/* Generated stub for param_pubkey */ -struct command_result *param_pubkey(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct pubkey **pubkey UNNEEDED) -{ fprintf(stderr, "param_pubkey called!\n"); abort(); } -/* Generated stub for param_secret */ -struct command_result *param_secret(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct secret **secret UNNEEDED) -{ fprintf(stderr, "param_secret called!\n"); abort(); } -/* Generated stub for param_secrets_array */ -struct command_result *param_secrets_array(struct command *cmd UNNEEDED, - const char *name UNNEEDED, const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - struct secret **secrets UNNEEDED) -{ fprintf(stderr, "param_secrets_array called!\n"); abort(); } -/* Generated stub for param_sha256 */ -struct command_result *param_sha256(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - struct sha256 **hash UNNEEDED) -{ fprintf(stderr, "param_sha256 called!\n"); abort(); } -/* Generated stub for param_short_channel_id */ -struct command_result *param_short_channel_id(struct command *cmd UNNEEDED, - const char *name UNNEEDED, - const char *buffer UNNEEDED, - const jsmntok_t *tok UNNEEDED, - struct short_channel_id **scid UNNEEDED) -{ fprintf(stderr, "param_short_channel_id called!\n"); abort(); } -/* Generated stub for param_string */ -struct command_result *param_string(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char * buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - const char **str UNNEEDED) -{ fprintf(stderr, "param_string called!\n"); abort(); } -/* Generated stub for param_u32 */ -struct command_result *param_u32(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - uint32_t **num UNNEEDED) -{ fprintf(stderr, "param_u32 called!\n"); abort(); } -/* Generated stub for param_u64 */ -struct command_result *param_u64(struct command *cmd UNNEEDED, const char *name UNNEEDED, - const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED, - uint64_t **num UNNEEDED) -{ fprintf(stderr, "param_u64 called!\n"); abort(); } -/* Generated stub for parse_onionpacket */ -struct onionpacket *parse_onionpacket(const tal_t *ctx UNNEEDED, - const u8 *src UNNEEDED, - const size_t srclen UNNEEDED, - enum onion_wire *failcode UNNEEDED) -{ fprintf(stderr, "parse_onionpacket called!\n"); abort(); } /* Generated stub for peer_restart_dualopend */ bool peer_restart_dualopend(struct peer *peer UNNEEDED, struct peer_fd *peer_fd UNNEEDED, @@ -995,26 +588,12 @@ bool peer_start_dualopend(struct peer *peer UNNEEDED, struct peer_fd *peer_fd UN bool peer_start_openingd(struct peer *peer UNNEEDED, struct peer_fd *peer_fd UNNEEDED) { fprintf(stderr, "peer_start_openingd called!\n"); abort(); } -/* Generated stub for peer_wire_name */ -const char *peer_wire_name(int e UNNEEDED) -{ fprintf(stderr, "peer_wire_name called!\n"); abort(); } /* Generated stub for plugin_hook_call_ */ bool plugin_hook_call_(struct lightningd *ld UNNEEDED, const struct plugin_hook *hook UNNEEDED, const char *cmd_id TAKES UNNEEDED, tal_t *cb_arg STEALS UNNEEDED) { fprintf(stderr, "plugin_hook_call_ called!\n"); abort(); } -/* Generated stub for primary_mvt_tag */ -enum mvt_tag primary_mvt_tag(struct mvt_tags tags UNNEEDED) -{ fprintf(stderr, "primary_mvt_tag called!\n"); abort(); } -/* Generated stub for process_onionpacket */ -struct route_step *process_onionpacket( - const tal_t * ctx UNNEEDED, - const struct onionpacket *packet UNNEEDED, - const struct secret *shared_secret UNNEEDED, - const u8 *assocdata UNNEEDED, - const size_t assocdatalen UNNEEDED) -{ fprintf(stderr, "process_onionpacket called!\n"); abort(); } /* Generated stub for psbt_fixup */ const u8 *psbt_fixup(const tal_t *ctx UNNEEDED, const u8 *psbtblob UNNEEDED) { fprintf(stderr, "psbt_fixup called!\n"); abort(); } @@ -1028,34 +607,6 @@ void resolve_close_command(struct lightningd *ld UNNEEDED, struct channel *chann /* Generated stub for rune_unique_id */ u64 rune_unique_id(const struct rune *rune UNNEEDED) { fprintf(stderr, "rune_unique_id called!\n"); abort(); } -/* Generated stub for serialize_onionpacket */ -u8 *serialize_onionpacket( - const tal_t *ctx UNNEEDED, - const struct onionpacket *packet UNNEEDED) -{ fprintf(stderr, "serialize_onionpacket called!\n"); abort(); } -/* Generated stub for sphinx_add_hop_has_length */ -bool sphinx_add_hop_has_length(struct sphinx_path *path UNNEEDED, const struct pubkey *pubkey UNNEEDED, - const u8 *payload TAKES UNNEEDED) -{ fprintf(stderr, "sphinx_add_hop_has_length called!\n"); abort(); } -/* Generated stub for sphinx_add_v0_hop */ -void sphinx_add_v0_hop(struct sphinx_path *path UNNEEDED, const struct pubkey *pubkey UNNEEDED, - const struct short_channel_id *scid UNNEEDED, - struct amount_msat forward UNNEEDED, u32 outgoing_cltv UNNEEDED) -{ fprintf(stderr, "sphinx_add_v0_hop called!\n"); abort(); } -/* Generated stub for sphinx_path_new */ -struct sphinx_path *sphinx_path_new(const tal_t *ctx UNNEEDED, - const u8 *associated_data UNNEEDED, - size_t associated_data_len UNNEEDED) -{ fprintf(stderr, "sphinx_path_new called!\n"); abort(); } -/* Generated stub for sphinx_path_new_with_key */ -struct sphinx_path *sphinx_path_new_with_key(const tal_t *ctx UNNEEDED, - const u8 *associated_data UNNEEDED, - size_t associated_data_len UNNEEDED, - const struct secret *session_key UNNEEDED) -{ fprintf(stderr, "sphinx_path_new_with_key called!\n"); abort(); } -/* Generated stub for sphinx_path_payloads_size */ -size_t sphinx_path_payloads_size(const struct sphinx_path *path UNNEEDED) -{ fprintf(stderr, "sphinx_path_payloads_size called!\n"); abort(); } /* Generated stub for start_leak_request */ void start_leak_request(const struct subd_req *req UNNEEDED, struct leak_detect *leak_detect UNNEEDED) @@ -1077,11 +628,6 @@ void subd_send_fd(struct subd *sd UNNEEDED, int fd UNNEEDED) /* Generated stub for subd_send_msg */ void subd_send_msg(struct subd *sd UNNEEDED, const u8 *msg_out UNNEEDED) { fprintf(stderr, "subd_send_msg called!\n"); abort(); } -/* Generated stub for subkey_from_hmac */ -void subkey_from_hmac(const char *prefix UNNEEDED, - const struct secret *base UNNEEDED, - struct secret *key UNNEEDED) -{ fprintf(stderr, "subkey_from_hmac called!\n"); abort(); } /* Generated stub for tell_connectd_peer_importance */ void tell_connectd_peer_importance(struct peer *peer UNNEEDED, bool was_important UNNEEDED) @@ -1089,9 +635,6 @@ void tell_connectd_peer_importance(struct peer *peer UNNEEDED, /* Generated stub for tlv_hsmd_dev_preinit_tlvs_new */ struct tlv_hsmd_dev_preinit_tlvs *tlv_hsmd_dev_preinit_tlvs_new(const tal_t *ctx UNNEEDED) { fprintf(stderr, "tlv_hsmd_dev_preinit_tlvs_new called!\n"); abort(); } -/* Generated stub for to_canonical_invstr */ -const char *to_canonical_invstr(const tal_t *ctx UNNEEDED, const char *invstring UNNEEDED) -{ fprintf(stderr, "to_canonical_invstr called!\n"); abort(); } /* Generated stub for topology_add_sync_waiter_ */ void topology_add_sync_waiter_(const tal_t *ctx UNNEEDED, struct chain_topology *topo UNNEEDED, @@ -1099,15 +642,6 @@ void topology_add_sync_waiter_(const tal_t *ctx UNNEEDED, void *) UNNEEDED, void *arg UNNEEDED) { fprintf(stderr, "topology_add_sync_waiter_ called!\n"); abort(); } -/* Generated stub for towire_announcement_signatures */ -u8 *towire_announcement_signatures(const tal_t *ctx UNNEEDED, const struct channel_id *channel_id UNNEEDED, struct short_channel_id short_channel_id UNNEEDED, const secp256k1_ecdsa_signature *node_signature UNNEEDED, const secp256k1_ecdsa_signature *bitcoin_signature UNNEEDED) -{ fprintf(stderr, "towire_announcement_signatures called!\n"); abort(); } -/* Generated stub for towire_channel_reestablish */ -u8 *towire_channel_reestablish(const tal_t *ctx UNNEEDED, const struct channel_id *channel_id UNNEEDED, u64 next_commitment_number UNNEEDED, u64 next_revocation_number UNNEEDED, const struct secret *your_last_per_commitment_secret UNNEEDED, const struct pubkey *my_current_per_commitment_point UNNEEDED, const struct tlv_channel_reestablish_tlvs *channel_reestablish UNNEEDED) -{ fprintf(stderr, "towire_channel_reestablish 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_channeld_dev_memleak */ u8 *towire_channeld_dev_memleak(const tal_t *ctx UNNEEDED) { fprintf(stderr, "towire_channeld_dev_memleak called!\n"); abort(); } @@ -1144,26 +678,6 @@ u8 *towire_connectd_peer_send_msg(const tal_t *ctx UNNEEDED, const struct node_i /* Generated stub for towire_dualopend_dev_memleak */ u8 *towire_dualopend_dev_memleak(const tal_t *ctx UNNEEDED) { fprintf(stderr, "towire_dualopend_dev_memleak called!\n"); abort(); } -/* Generated stub for towire_errorfmt */ -u8 *towire_errorfmt(const tal_t *ctx UNNEEDED, - const struct channel_id *channel UNNEEDED, - const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "towire_errorfmt called!\n"); abort(); } -/* Generated stub for towire_expiry_too_far */ -u8 *towire_expiry_too_far(const tal_t *ctx UNNEEDED) -{ fprintf(stderr, "towire_expiry_too_far called!\n"); abort(); } -/* Generated stub for towire_expiry_too_soon */ -u8 *towire_expiry_too_soon(const tal_t *ctx UNNEEDED, const u8 *channel_update UNNEEDED) -{ fprintf(stderr, "towire_expiry_too_soon called!\n"); abort(); } -/* Generated stub for towire_fee_insufficient */ -u8 *towire_fee_insufficient(const tal_t *ctx UNNEEDED, struct amount_msat htlc_msat UNNEEDED, const u8 *channel_update UNNEEDED) -{ fprintf(stderr, "towire_fee_insufficient called!\n"); abort(); } -/* Generated stub for towire_final_incorrect_cltv_expiry */ -u8 *towire_final_incorrect_cltv_expiry(const tal_t *ctx UNNEEDED, u32 cltv_expiry UNNEEDED) -{ fprintf(stderr, "towire_final_incorrect_cltv_expiry called!\n"); abort(); } -/* Generated stub for towire_final_incorrect_htlc_amount */ -u8 *towire_final_incorrect_htlc_amount(const tal_t *ctx UNNEEDED, struct amount_msat incoming_htlc_amt UNNEEDED) -{ fprintf(stderr, "towire_final_incorrect_htlc_amount called!\n"); abort(); } /* Generated stub for towire_gossipd_addgossip */ u8 *towire_gossipd_addgossip(const tal_t *ctx UNNEEDED, const u8 *msg UNNEEDED, struct amount_sat *known_channel UNNEEDED) { fprintf(stderr, "towire_gossipd_addgossip called!\n"); abort(); } @@ -1182,6 +696,9 @@ u8 *towire_hsmd_derive_secret(const tal_t *ctx UNNEEDED, const u8 *info UNNEEDED /* Generated stub for towire_hsmd_dev_preinit */ u8 *towire_hsmd_dev_preinit(const tal_t *ctx UNNEEDED, const struct tlv_hsmd_dev_preinit_tlvs *tlvs UNNEEDED) { fprintf(stderr, "towire_hsmd_dev_preinit called!\n"); abort(); } +/* Generated stub for towire_hsmd_ecdh_req */ +u8 *towire_hsmd_ecdh_req(const tal_t *ctx UNNEEDED, const struct pubkey *point UNNEEDED) +{ fprintf(stderr, "towire_hsmd_ecdh_req called!\n"); abort(); } /* Generated stub for towire_hsmd_forget_channel */ u8 *towire_hsmd_forget_channel(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED, u64 dbid UNNEEDED) { fprintf(stderr, "towire_hsmd_forget_channel called!\n"); abort(); } @@ -1203,18 +720,6 @@ u8 *towire_hsmd_sign_any_cannouncement_req(const tal_t *ctx UNNEEDED, const u8 * /* Generated stub for towire_hsmd_sign_commitment_tx */ u8 *towire_hsmd_sign_commitment_tx(const tal_t *ctx UNNEEDED, const struct node_id *peer_id UNNEEDED, u64 channel_dbid UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const struct pubkey *remote_funding_key UNNEEDED, u64 commit_num UNNEEDED) { fprintf(stderr, "towire_hsmd_sign_commitment_tx called!\n"); abort(); } -/* Generated stub for towire_incorrect_cltv_expiry */ -u8 *towire_incorrect_cltv_expiry(const tal_t *ctx UNNEEDED, u32 cltv_expiry UNNEEDED, const u8 *channel_update UNNEEDED) -{ fprintf(stderr, "towire_incorrect_cltv_expiry called!\n"); abort(); } -/* Generated stub for towire_incorrect_or_unknown_payment_details */ -u8 *towire_incorrect_or_unknown_payment_details(const tal_t *ctx UNNEEDED, struct amount_msat htlc_msat UNNEEDED, u32 height UNNEEDED) -{ fprintf(stderr, "towire_incorrect_or_unknown_payment_details called!\n"); abort(); } -/* Generated stub for towire_invalid_onion_blinding */ -u8 *towire_invalid_onion_blinding(const tal_t *ctx UNNEEDED, const struct sha256 *sha256_of_onion UNNEEDED) -{ fprintf(stderr, "towire_invalid_onion_blinding called!\n"); abort(); } -/* Generated stub for towire_invalid_onion_payload */ -u8 *towire_invalid_onion_payload(const tal_t *ctx UNNEEDED, bigsize type UNNEEDED, u16 offset UNNEEDED) -{ fprintf(stderr, "towire_invalid_onion_payload called!\n"); abort(); } /* Generated stub for towire_onchaind_dev_memleak */ u8 *towire_onchaind_dev_memleak(const tal_t *ctx UNNEEDED) { fprintf(stderr, "towire_onchaind_dev_memleak called!\n"); abort(); } @@ -1224,23 +729,6 @@ u8 *towire_onchaind_known_preimage(const tal_t *ctx UNNEEDED, const struct preim /* Generated stub for towire_openingd_dev_memleak */ u8 *towire_openingd_dev_memleak(const tal_t *ctx UNNEEDED) { fprintf(stderr, "towire_openingd_dev_memleak called!\n"); abort(); } -/* Generated stub for towire_permanent_channel_failure */ -u8 *towire_permanent_channel_failure(const tal_t *ctx UNNEEDED) -{ fprintf(stderr, "towire_permanent_channel_failure called!\n"); abort(); } -/* Generated stub for towire_temporary_channel_failure */ -u8 *towire_temporary_channel_failure(const tal_t *ctx UNNEEDED, const u8 *channel_update UNNEEDED) -{ fprintf(stderr, "towire_temporary_channel_failure called!\n"); abort(); } -/* Generated stub for towire_temporary_node_failure */ -u8 *towire_temporary_node_failure(const tal_t *ctx UNNEEDED) -{ fprintf(stderr, "towire_temporary_node_failure called!\n"); abort(); } -/* Generated stub for towire_unknown_next_peer */ -u8 *towire_unknown_next_peer(const tal_t *ctx UNNEEDED) -{ fprintf(stderr, "towire_unknown_next_peer called!\n"); abort(); } -/* Generated stub for towire_warningfmt */ -u8 *towire_warningfmt(const tal_t *ctx UNNEEDED, - const struct channel_id *channel UNNEEDED, - const char *fmt UNNEEDED, ...) -{ fprintf(stderr, "towire_warningfmt called!\n"); abort(); } /* Generated stub for unsigned_channel_update */ u8 *unsigned_channel_update(const tal_t *ctx UNNEEDED, const struct channel *channel UNNEEDED, @@ -1254,13 +742,6 @@ u8 *unsigned_node_announcement(const tal_t *ctx UNNEEDED, struct lightningd *ld UNNEEDED, const u8 *prev UNNEEDED) { fprintf(stderr, "unsigned_node_announcement called!\n"); abort(); } -/* Generated stub for unwrap_onionreply */ -u8 *unwrap_onionreply(const tal_t *ctx UNNEEDED, - const struct secret *shared_secrets UNNEEDED, - const int numhops UNNEEDED, - const struct onionreply *reply UNNEEDED, - int *origin_index UNNEEDED) -{ fprintf(stderr, "unwrap_onionreply called!\n"); abort(); } /* Generated stub for watch_opening_inflight */ void watch_opening_inflight(struct lightningd *ld UNNEEDED, struct channel_inflight *inflight UNNEEDED) @@ -1290,11 +771,6 @@ struct txowatch *watch_txo(const tal_t *ctx UNNEEDED, size_t input_num UNNEEDED, const struct block *block)) { fprintf(stderr, "watch_txo called!\n"); abort(); } -/* Generated stub for wrap_onionreply */ -struct onionreply *wrap_onionreply(const tal_t *ctx UNNEEDED, - const struct secret *shared_secret UNNEEDED, - const struct onionreply *reply UNNEEDED) -{ fprintf(stderr, "wrap_onionreply called!\n"); abort(); } /* AUTOGENERATED MOCKS END */ /* Fake stubs to talk to hsm */ diff --git a/wallet/txfilter.c b/wallet/txfilter.c index 10ef774e41b0..a8b32db6b459 100644 --- a/wallet/txfilter.c +++ b/wallet/txfilter.c @@ -1,9 +1,7 @@ #include "config.h" #include -#include -#include #include -#include +#include #include #include diff --git a/wallet/wallet.c b/wallet/wallet.c index 599e2f920ade..d2dc7d08b14a 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -14,20 +12,17 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include #include #include #include -#include #define SQLITE_MAX_UINT 0x7FFFFFFFFFFFFFFF #define DIRECTION_INCOMING 0 diff --git a/wallet/wallet.h b/wallet/wallet.h index f956196b37cd..7eb1a51c0f59 100644 --- a/wallet/wallet.h +++ b/wallet/wallet.h @@ -18,6 +18,7 @@ #include struct amount_msat; +struct bitcoin_signature; struct invoices; struct channel; struct channel_inflight; diff --git a/wallet/walletrpc.c b/wallet/walletrpc.c index 677db8bab66f..6155c899ed53 100644 --- a/wallet/walletrpc.c +++ b/wallet/walletrpc.c @@ -1,30 +1,19 @@ #include "config.h" -#include #include -#include -#include #include #include #include -#include #include -#include -#include #include #include #include #include #include -#include #include #include -#include -#include #include -#include #include #include -#include #include /* May return NULL if encoding error occurs. */ diff --git a/wire/Makefile b/wire/Makefile index 87c882c0c3a8..6d10c3e6b984 100644 --- a/wire/Makefile +++ b/wire/Makefile @@ -1,48 +1,29 @@ #! /usr/bin/make -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/bolt12_wiregen.h \ - wire/channel_type_wiregen.h \ - wire/bolt12_printgen.h \ - wire/peer_printgen.h \ - wire/onion_printgen.h - -# We don't include peer_printgen/onion_printgen or bolt12 here since most don't need it. +WIRE_SRC_NOHDR := wire/fromwire.c \ + wire/towire.c \ + WIRE_SRC := wire/wire_sync.c \ wire/wire_io.c \ - wire/fromwire.c \ wire/peer_wire.c \ wire/tlvstream.c \ - wire/towire.c \ wire/peer_wiregen.c \ wire/channel_type_wiregen.c \ - wire/onion_wiregen.c - -WIRE_BOLT12_SRC := wire/bolt12_wiregen.c - -WIRE_PRINT_SRC := \ + wire/onion_wiregen.c \ + wire/bolt12_wiregen.c \ wire/onion_printgen.c \ wire/peer_printgen.c \ wire/bolt12_printgen.c \ wire/channel_type_printgen.c -WIRE_PRINT_HEADERS := $(WIRE_PRINT_SRC:.c=.h) - -WIRE_OBJS := $(WIRE_SRC:.c=.o) common/sciddir_or_pubkey.o -WIRE_PRINT_OBJS := $(WIRE_PRINT_SRC:.c=.o) -WIRE_BOLT12_OBJS := $(WIRE_BOLT12_SRC:.c=.o) -$(WIRE_OBJS) $(WIRE_PRINT_OBJS) $(WIRE_BOLT12_OBJS): $(WIRE_HEADERS) $(WIRE_PRINT_HEADERS) +WIRE_HEADERS := wire/onion_defs.h \ + wire/wire.h \ + $(WIRE_SRC:.c=.h) -ALL_C_SOURCES += $(WIRE_SRC) $(WIRE_BOLT12_SRC) $(WIRE_PRINT_SRC) +WIRE_OBJS := $(WIRE_SRC:.c=.o) $(WIRE_SRC_NOHDR:.c=.o) +$(WIRE_OBJS): $(WIRE_HEADERS) +ALL_C_SOURCES += $(WIRE_SRC) $(WIRE_SRC_NOHDR) ALL_C_HEADERS += $(WIRE_HEADERS) # They may not have the bolts. @@ -93,6 +74,8 @@ wire/peer_wiregen.h_args := --include='common/channel_id.h' --include='bitcoin/t wire/peer_wiregen.c_args := -s --expose-tlv-type=tlv_n1 --expose-tlv-type=tlv_n2 +wire/peer_printgen.c_args := --include='wire/peer_wiregen.h' + # The payload isn't parsed in a fromwire, so we need to expose it. wire/onion_wiregen.h_args := --include='bitcoin/short_channel_id.h' --include='bitcoin/privkey.h' --include='common/bigsize.h' --include='common/amount.h' --include='common/node_id.h' --include='bitcoin/block.h' --include='common/sciddir_or_pubkey.h' -s --expose-tlv-type=tlv_payload @@ -105,8 +88,8 @@ 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) -wire/bolt12_wiregen.c_args := -s --expose-tlv-type=tlv_blinded_path --expose-tlv-type=tlv_invoice_request --expose-tlv-type=tlv_invoice -wire/bolt12_wiregen.h_args := --include='bitcoin/short_channel_id.h' --include='bitcoin/signature.h' --include='bitcoin/privkey.h' --include='common/bigsize.h' --include='common/amount.h' --include='common/node_id.h' --include='bitcoin/block.h' --include='wire/onion_wire.h' $(wire/bolt12_wiregen.c_args) +wire/bolt12_wiregen.c_args := -s --expose-tlv-type=tlv_blinded_path --expose-tlv-type=tlv_invoice_request --expose-tlv-type=tlv_invoice --include='wire/onion_wiregen.h' +wire/bolt12_wiregen.h_args := --include='bitcoin/short_channel_id.h' --include='bitcoin/signature.h' --include='bitcoin/privkey.h' --include='common/bigsize.h' --include='common/amount.h' --include='common/node_id.h' --include='bitcoin/block.h' $(wire/bolt12_wiregen.c_args) wire/bolt12_printgen.c_args := --expose-tlv-type=tlv_blinded_path --expose-tlv-type=tlv_invoice_request --include='wire/onion_wiregen.h' --include='wire/onion_printgen.h' wire/bolt12_printgen.h_args := --include='wire/bolt12_wiregen.h' --expose-tlv-type=tlv_blinded_path --expose-tlv-type=tlv_invoice_request @@ -123,7 +106,7 @@ 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_BOLT12_SRC) $(WIRE_PRINT_SRC) $(WIRE_HEADERS)): wire/Makefile +$(filter %printgen.h %printgen.c %wiregen.h %wiregen.c, $(WIRE_SRC) $(WIRE_HEADERS)): wire/Makefile maintainer-clean: wire-maintainer-clean diff --git a/wire/onion_defs.h b/wire/onion_defs.h index cdfc0b3b8d78..312636f79861 100644 --- a/wire/onion_defs.h +++ b/wire/onion_defs.h @@ -2,7 +2,6 @@ #ifndef LIGHTNING_WIRE_ONION_DEFS_H #define LIGHTNING_WIRE_ONION_DEFS_H #include "config.h" -#include /* BOLT #4: * diff --git a/wire/onion_wire.h b/wire/onion_wire.h deleted file mode 100644 index 54947d4db822..000000000000 --- a/wire/onion_wire.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef LIGHTNING_WIRE_ONION_WIRE_H -#define LIGHTNING_WIRE_ONION_WIRE_H -#include "config.h" -#include - -#include - -#endif /* LIGHTNING_WIRE_ONION_WIRE_H */ diff --git a/wire/peer_wire.h b/wire/peer_wire.h index 2097a3c9d580..760e06230293 100644 --- a/wire/peer_wire.h +++ b/wire/peer_wire.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_WIRE_PEER_WIRE_H #define LIGHTNING_WIRE_PEER_WIRE_H #include "config.h" -#include #include diff --git a/wire/test/Makefile b/wire/test/Makefile index 997a72dae737..276cab6cf9c6 100644 --- a/wire/test/Makefile +++ b/wire/test/Makefile @@ -20,7 +20,7 @@ WIRE_TEST_COMMON_OBJS := \ # run-tlvstream.c needs to reach into bitcoin/pubkey for SUPERVERBOSE $(WIRE_TEST_PROGRAMS): $(WIRE_TEST_COMMON_OBJS) $(filter-out bitcoin/pubkey.o bitcoin/chainparams.o,$(BITCOIN_OBJS)) -$(WIRE_TEST_OBJS): $(WIRE_HEADERS) $(WIRE_SRC) $(WIRE_PRINT_SRC) +$(WIRE_TEST_OBJS): $(WIRE_HEADERS) $(WIRE_SRC) $(WIRE_PRINT_SRC) wire/test/Makefile wire-tests: $(WIRE_TEST_PROGRAMS:%=unittest/%) diff --git a/wire/tlvstream.c b/wire/tlvstream.c index 9e1c774261bb..8afb7f2b4901 100644 --- a/wire/tlvstream.c +++ b/wire/tlvstream.c @@ -1,6 +1,7 @@ #include "config.h" #include #include +#include #include #include diff --git a/wire/tlvstream.h b/wire/tlvstream.h index 090ba4e21433..a8a76e340e90 100644 --- a/wire/tlvstream.h +++ b/wire/tlvstream.h @@ -2,8 +2,6 @@ #define LIGHTNING_WIRE_TLVSTREAM_H #include "config.h" #include -#include -#include struct tlv_record_type { u64 type; diff --git a/wire/towire.c b/wire/towire.c index f275367e4c03..b90c7e3d1793 100644 --- a/wire/towire.c +++ b/wire/towire.c @@ -2,7 +2,6 @@ #include "wire.h" #include #include -#include #include #include #include diff --git a/wire/wire.h b/wire/wire.h index 548f5b07412d..8e8f12ac6164 100644 --- a/wire/wire.h +++ b/wire/wire.h @@ -1,12 +1,9 @@ #ifndef LIGHTNING_WIRE_WIRE_H #define LIGHTNING_WIRE_WIRE_H #include "config.h" -#include -#include #include #include #include -#include struct ripemd160; struct sha256; diff --git a/wire/wire_io.c b/wire/wire_io.c index 26051c8d5120..7cbdde378577 100644 --- a/wire/wire_io.c +++ b/wire/wire_io.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include