gossipd: use a separate CSV file for the gossip_store types.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-04-11 08:33:36 +09:30 committed by Christian Decker
parent 57b38cac71
commit b0c2e3cd5c
9 changed files with 25 additions and 47 deletions

View File

@ -13,6 +13,7 @@ LIGHTNINGD_GOSSIP_CONTROL_OBJS := $(LIGHTNINGD_GOSSIP_CONTROL_SRC:.c=.o)
# gossipd needs these:
LIGHTNINGD_GOSSIP_HEADERS := gossipd/gen_gossip_wire.h \
gossipd/gen_gossip_store.h \
gossipd/gossip_store.h \
gossipd/handshake.h \
gossipd/routing.h \
@ -76,6 +77,13 @@ gossipd/gen_gossip_wire.h: $(WIRE_GEN) gossipd/gossip_wire.csv
gossipd/gen_gossip_wire.c: $(WIRE_GEN) gossipd/gossip_wire.csv
$(WIRE_GEN) ${@:.c=.h} gossip_wire_type < gossipd/gossip_wire.csv > $@
gossipd/gen_gossip_store.h: $(WIRE_GEN) gossipd/gossip_store.csv
$(WIRE_GEN) --header $@ gossip_store_type < gossipd/gossip_store.csv > $@
gossipd/gen_gossip_store.c: $(WIRE_GEN) gossipd/gossip_store.csv
$(WIRE_GEN) ${@:.c=.h} gossip_store_type < gossipd/gossip_store.csv > $@
check-source: $(LIGHTNINGD_GOSSIP_ALLSRC_NOGEN:%=check-src-include-order/%) $(LIGHTNINGD_GOSSIP_ALLHEADERS_NOGEN:%=check-hdr-include-order/%)
check-source-bolt: $(LIGHTNINGD_GOSSIP_SRC:%=bolt-check/%) $(LIGHTNINGD_GOSSIP_HEADERS:%=bolt-check/%)
check-whitespace: $(LIGHTNINGD_GOSSIP_ALLSRC_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_GOSSIP_ALLHEADERS_NOGEN:%=check-whitespace/%)

View File

@ -2092,11 +2092,6 @@ static struct io_plan *recv_req(struct io_conn *conn, struct daemon_conn *master
case WIRE_GOSSIP_GET_TXOUT:
case WIRE_GOSSIPCTL_PEER_DISCONNECT_REPLY:
case WIRE_GOSSIPCTL_PEER_DISCONNECT_REPLYFAIL:
/* gossip_store messages */
case WIRE_GOSSIP_STORE_CHANNEL_ANNOUNCEMENT:
case WIRE_GOSSIP_STORE_CHANNEL_UPDATE:
case WIRE_GOSSIP_STORE_NODE_ANNOUNCEMENT:
case WIRE_GOSSIP_STORE_CHANNEL_DELETE:
break;
}

View File

@ -6,7 +6,7 @@
#include <common/utils.h>
#include <errno.h>
#include <fcntl.h>
#include <gossipd/gen_gossip_wire.h>
#include <gossipd/gen_gossip_store.h>
#include <unistd.h>
#include <wire/gen_peer_wire.h>
#include <wire/wire.h>

16
gossipd/gossip_store.csv Normal file
View File

@ -0,0 +1,16 @@
# gossip_store messages: messages persisted in the gossip_store
gossip_store_channel_announcement,4096
gossip_store_channel_announcement,,len,u16
gossip_store_channel_announcement,,announcement,len*u8
gossip_store_channel_announcement,,satoshis,u64
gossip_store_channel_update,4097
gossip_store_channel_update,,len,u16
gossip_store_channel_update,,update,len*u8
gossip_store_node_announcement,4098
gossip_store_node_announcement,,len,u16
gossip_store_node_announcement,,announcement,len*u8
gossip_store_channel_delete,4099
gossip_store_channel_delete,,short_channel_id,struct short_channel_id
1 # gossip_store messages: messages persisted in the gossip_store
2 gossip_store_channel_announcement,4096
3 gossip_store_channel_announcement,,len,u16
4 gossip_store_channel_announcement,,announcement,len*u8
5 gossip_store_channel_announcement,,satoshis,u64
6 gossip_store_channel_update,4097
7 gossip_store_channel_update,,len,u16
8 gossip_store_channel_update,,update,len*u8
9 gossip_store_node_announcement,4098
10 gossip_store_node_announcement,,len,u16
11 gossip_store_node_announcement,,announcement,len*u8
12 gossip_store_channel_delete,4099
13 gossip_store_channel_delete,,short_channel_id,struct short_channel_id

View File

@ -228,20 +228,3 @@ gossipctl_peer_disconnect_replyfail,,isconnected,bool
# master -> gossipd: a potential funding outpoint was spent, please forget the eventual channel
gossip_outpoint_spent,3024
gossip_outpoint_spent,,short_channel_id,struct short_channel_id
# gossip_store messages: messages persisted in the gossip_store
gossip_store_channel_announcement,4096
gossip_store_channel_announcement,,len,u16
gossip_store_channel_announcement,,announcement,len*u8
gossip_store_channel_announcement,,satoshis,u64
gossip_store_channel_update,4097
gossip_store_channel_update,,len,u16
gossip_store_channel_update,,update,len*u8
gossip_store_node_announcement,4098
gossip_store_node_announcement,,len,u16
gossip_store_node_announcement,,announcement,len*u8
gossip_store_channel_delete,4099
gossip_store_channel_delete,,short_channel_id,struct short_channel_id

1 #include <common/cryptomsg.h>
228
229
230

View File

@ -77,18 +77,12 @@ bool fromwire_gossip_store_node_announcement(const tal_t *ctx UNNEEDED, const vo
/* Generated stub for fromwire_node_announcement */
bool fromwire_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, u8 **features UNNEEDED, u32 *timestamp UNNEEDED, struct pubkey *node_id UNNEEDED, u8 rgb_color[3] UNNEEDED, u8 alias[32] UNNEEDED, u8 **addresses UNNEEDED)
{ fprintf(stderr, "fromwire_node_announcement 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_u8 */
u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
{ fprintf(stderr, "fromwire_u8 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 gossip_wire_type_name */
const char *gossip_wire_type_name(int e UNNEEDED)
{ fprintf(stderr, "gossip_wire_type_name called!\n"); abort(); }
/* Generated stub for onion_type_name */
const char *onion_type_name(int e UNNEEDED)
{ fprintf(stderr, "onion_type_name called!\n"); abort(); }

View File

@ -41,18 +41,12 @@ bool fromwire_gossip_store_node_announcement(const tal_t *ctx UNNEEDED, const vo
/* Generated stub for fromwire_node_announcement */
bool fromwire_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, u8 **features UNNEEDED, u32 *timestamp UNNEEDED, struct pubkey *node_id UNNEEDED, u8 rgb_color[3] UNNEEDED, u8 alias[32] UNNEEDED, u8 **addresses UNNEEDED)
{ fprintf(stderr, "fromwire_node_announcement 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_u8 */
u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
{ fprintf(stderr, "fromwire_u8 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 gossip_wire_type_name */
const char *gossip_wire_type_name(int e UNNEEDED)
{ fprintf(stderr, "gossip_wire_type_name called!\n"); abort(); }
/* Generated stub for onion_type_name */
const char *onion_type_name(int e UNNEEDED)
{ fprintf(stderr, "onion_type_name called!\n"); abort(); }

View File

@ -39,18 +39,12 @@ bool fromwire_gossip_store_node_announcement(const tal_t *ctx UNNEEDED, const vo
/* Generated stub for fromwire_node_announcement */
bool fromwire_node_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, u8 **features UNNEEDED, u32 *timestamp UNNEEDED, struct pubkey *node_id UNNEEDED, u8 rgb_color[3] UNNEEDED, u8 alias[32] UNNEEDED, u8 **addresses UNNEEDED)
{ fprintf(stderr, "fromwire_node_announcement 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_u8 */
u8 fromwire_u8(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
{ fprintf(stderr, "fromwire_u8 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 gossip_wire_type_name */
const char *gossip_wire_type_name(int e UNNEEDED)
{ fprintf(stderr, "gossip_wire_type_name called!\n"); abort(); }
/* Generated stub for onion_type_name */
const char *onion_type_name(int e UNNEEDED)
{ fprintf(stderr, "onion_type_name called!\n"); abort(); }

View File

@ -149,12 +149,6 @@ static unsigned gossip_msg(struct subd *gossip, const u8 *msg, const int *fds)
case WIRE_GOSSIPCTL_RELEASE_PEER_REPLYFAIL:
case WIRE_GOSSIPCTL_PEER_DISCONNECT_REPLY:
case WIRE_GOSSIPCTL_PEER_DISCONNECT_REPLYFAIL:
/* gossip_store messages */
case WIRE_GOSSIP_STORE_CHANNEL_ANNOUNCEMENT:
case WIRE_GOSSIP_STORE_CHANNEL_UPDATE:
case WIRE_GOSSIP_STORE_NODE_ANNOUNCEMENT:
case WIRE_GOSSIP_STORE_CHANNEL_DELETE:
break;
/* These are inter-daemon messages, not received by us */
case WIRE_GOSSIP_LOCAL_ADD_CHANNEL:
break;