Browse Source

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

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
b0c2e3cd5c
  1. 8
      gossipd/Makefile
  2. 5
      gossipd/gossip.c
  3. 2
      gossipd/gossip_store.c
  4. 16
      gossipd/gossip_store.csv
  5. 17
      gossipd/gossip_wire.csv
  6. 6
      gossipd/test/run-bench-find_route.c
  7. 6
      gossipd/test/run-find_route-specific.c
  8. 6
      gossipd/test/run-find_route.c
  9. 6
      lightningd/gossip_control.c

8
gossipd/Makefile

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

5
gossipd/gossip.c

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

2
gossipd/gossip_store.c

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

@ -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
Can't render this file because it has a wrong number of fields in line 2.

17
gossipd/gossip_wire.csv

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

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

6
gossipd/test/run-bench-find_route.c

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

6
gossipd/test/run-find_route-specific.c

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

6
gossipd/test/run-find_route.c

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

6
lightningd/gossip_control.c

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

Loading…
Cancel
Save