common: Add scb_wire for serializing the static_chan_backup

This commit is contained in:
adi2011
2022-06-24 06:04:32 +05:30
committed by neil saitug
parent 64c03f8990
commit e42ba8366b
6 changed files with 34 additions and 3 deletions

View File

@@ -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))" = "" ])

21
common/scb_wire.csv Normal file
View File

@@ -0,0 +1,21 @@
#include <common/node_id.h>
#include <common/channel_id.h>
#include <common/wireaddr.h>
#include <common/channel_type.h>
#include <common/amount.h>
#include <bitcoin/tx.h>
# 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
1 #include <common/node_id.h>
2 #include <common/channel_id.h>
3 #include <common/wireaddr.h>
4 #include <common/channel_type.h>
5 #include <common/amount.h>
6 #include <bitcoin/tx.h>
7 # scb_chan stores min. info required to sweep the peer's force close.
8 subtype,scb_chan
9 subtypedata,scb_chan,id,u64,
10 subtypedata,scb_chan,cid,channel_id,
11 subtypedata,scb_chan,node_id,node_id,
12 subtypedata,scb_chan,addr,wireaddr_internal,
13 subtypedata,scb_chan,funding,bitcoin_outpoint,
14 subtypedata,scb_chan,funding_sats,amount_sat,
15 subtypedata,scb_chan,type,channel_type,
16 msgtype,static_chan_backup,6135,
17 msgdata,static_chan_backup,version,u64,
18 msgdata,static_chan_backup,timestamp,u32,
19 msgdata,static_chan_backup,num,u16,
20 msgdata,static_chan_backup,channels,scb_chan,num

View File

@@ -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 \

View File

@@ -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,

View File

@@ -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

View File

@@ -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(); }