diff --git a/common/Makefile b/common/Makefile index 3665baf4f..d18494317 100644 --- a/common/Makefile +++ b/common/Makefile @@ -91,7 +91,7 @@ COMMON_SRC_NOGEN := \ common/wire_error.c -COMMON_SRC_GEN := common/status_wiregen.c common/peer_status_wiregen.c +COMMON_SRC_GEN := common/status_wiregen.c common/peer_status_wiregen.c common/scb_wiregen.c COMMON_HEADERS_NOGEN := $(COMMON_SRC_NOGEN:.c=.h) \ common/closing_fee.h \ @@ -105,13 +105,16 @@ COMMON_HEADERS_NOGEN := $(COMMON_SRC_NOGEN:.c=.h) \ common/overflows.h \ common/tx_roles.h -COMMON_HEADERS_GEN := common/htlc_state_names_gen.h common/status_wiregen.h common/peer_status_wiregen.h +COMMON_HEADERS_GEN := common/htlc_state_names_gen.h common/status_wiregen.h common/peer_status_wiregen.h common/scb_wiregen.h COMMON_HEADERS := $(COMMON_HEADERS_GEN) $(COMMON_HEADERS_NOGEN) COMMON_SRC := $(COMMON_SRC_NOGEN) $(COMMON_SRC_GEN) COMMON_OBJS := $(COMMON_SRC:.c=.o) +common/scb_wiregen.h_args := -s +common/scb_wiregen.c_args := -s + # Check that all h and c files are in the Makefile! check-common-files: @$(call VERBOSE, "MISSING-SRC common", [ "$(filter-out $(COMMON_SRC), $(wildcard common/*.c))" = "" ]) diff --git a/common/scb_wire.csv b/common/scb_wire.csv new file mode 100644 index 000000000..f27667caf --- /dev/null +++ b/common/scb_wire.csv @@ -0,0 +1,21 @@ +#include +#include +#include +#include +#include +#include + +# scb_chan stores min. info required to sweep the peer's force close. +subtype,scb_chan +subtypedata,scb_chan,id,u64, +subtypedata,scb_chan,cid,channel_id, +subtypedata,scb_chan,node_id,node_id, +subtypedata,scb_chan,addr,wireaddr_internal, +subtypedata,scb_chan,funding,bitcoin_outpoint, +subtypedata,scb_chan,funding_sats,amount_sat, +subtypedata,scb_chan,type,channel_type, +msgtype,static_chan_backup,6135, +msgdata,static_chan_backup,version,u64, +msgdata,static_chan_backup,timestamp,u32, +msgdata,static_chan_backup,num,u16, +msgdata,static_chan_backup,channels,scb_chan,num diff --git a/lightningd/Makefile b/lightningd/Makefile index f1f1607ea..cf997370c 100644 --- a/lightningd/Makefile +++ b/lightningd/Makefile @@ -90,6 +90,7 @@ LIGHTNINGD_COMMON_OBJS := \ 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 \ diff --git a/lightningd/test/run-invoice-select-inchan.c b/lightningd/test/run-invoice-select-inchan.c index 01699c8b4..fab4c8a48 100644 --- a/lightningd/test/run-invoice-select-inchan.c +++ b/lightningd/test/run-invoice-select-inchan.c @@ -694,6 +694,9 @@ u8 *towire_onchaind_dev_memleak(const tal_t *ctx UNNEEDED) /* 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_scb_chan */ +void towire_scb_chan(u8 **p UNNEEDED, const struct scb_chan *scb_chan UNNEEDED) +{ fprintf(stderr, "towire_scb_chan called!\n"); abort(); } /* Generated stub for towire_warningfmt */ u8 *towire_warningfmt(const tal_t *ctx UNNEEDED, const struct channel_id *channel UNNEEDED, diff --git a/tools/generate-wire.py b/tools/generate-wire.py index e0476b11f..19e658d93 100755 --- a/tools/generate-wire.py +++ b/tools/generate-wire.py @@ -244,7 +244,7 @@ class Type(FieldSet): 'tx_parts', 'wally_psbt', 'wally_tx', - 'channel_type', + 'scb_chan', ] # Some BOLT types are re-typed based on their field name diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c index 65cf287f8..94cb6a29e 100644 --- a/wallet/test/run-wallet.c +++ b/wallet/test/run-wallet.c @@ -809,6 +809,9 @@ u8 *towire_required_channel_feature_missing(const tal_t *ctx UNNEEDED) /* Generated stub for towire_required_node_feature_missing */ u8 *towire_required_node_feature_missing(const tal_t *ctx UNNEEDED) { fprintf(stderr, "towire_required_node_feature_missing called!\n"); abort(); } +/* Generated stub for towire_scb_chan */ +void towire_scb_chan(u8 **p UNNEEDED, const struct scb_chan *scb_chan UNNEEDED) +{ fprintf(stderr, "towire_scb_chan 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(); }