Browse Source

gossipd: get gossip_min_interval from lightningd.

Default is 5 x gossip interval == 5 minutes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
parent
commit
178baeba6c
  1. 1
      gossipd/gossip_wire.csv
  2. 6
      gossipd/gossipd.c
  3. 5
      gossipd/test/run-crc32_of_update.c
  4. 5
      gossipd/test/run-extended-info.c
  5. 2
      lightningd/gossip_control.c

1
gossipd/gossip_wire.csv

@ -11,6 +11,7 @@ msgdata,gossipctl_init,globalfeatures,u8,gflen
msgdata,gossipctl_init,rgb,u8,3
msgdata,gossipctl_init,alias,u8,32
msgdata,gossipctl_init,update_channel_interval,u32,
msgdata,gossipctl_init,gossip_min_interval,u32,
msgdata,gossipctl_init,num_announcable,u16,
msgdata,gossipctl_init,announcable,wireaddr,num_announcable
msgdata,gossipctl_init,dev_gossip_time,?u32,

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

6
gossipd/gossipd.c

@ -133,6 +133,9 @@ struct daemon {
/* Timers: we batch gossip, and also refresh announcements */
struct timers timers;
/* Minimum interval for generating updated gossip */
u32 gossip_min_interval;
/* Global features to list in node_announcement. */
u8 *globalfeatures;
@ -2475,6 +2478,9 @@ static struct io_plan *gossip_init(struct io_conn *conn,
/* 1 week in seconds
* (unless --dev-channel-update-interval) */
&update_channel_interval,
/* 5 minutes, or
* --dev-broadcast-interval * 5 seconds */
&daemon->gossip_min_interval,
&daemon->announcable,
&dev_gossip_time)) {
master_badmsg(WIRE_GOSSIPCTL_INIT, msg);

5
gossipd/test/run-crc32_of_update.c

@ -54,7 +54,7 @@ bool fromwire_expiry_too_soon(const tal_t *ctx UNNEEDED, const void *p UNNEEDED,
bool fromwire_fee_insufficient(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct amount_msat *htlc_msat UNNEEDED, u8 **channel_update UNNEEDED)
{ fprintf(stderr, "fromwire_fee_insufficient called!\n"); abort(); }
/* Generated stub for fromwire_gossipctl_init */
bool fromwire_gossipctl_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct node_id *id UNNEEDED, u8 **globalfeatures UNNEEDED, u8 rgb[3] UNNEEDED, u8 alias[32] UNNEEDED, u32 *update_channel_interval UNNEEDED, struct wireaddr **announcable UNNEEDED, u32 **dev_gossip_time UNNEEDED)
bool fromwire_gossipctl_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct node_id *id UNNEEDED, u8 **globalfeatures UNNEEDED, u8 rgb[3] UNNEEDED, u8 alias[32] UNNEEDED, u32 *update_channel_interval UNNEEDED, u32 *gossip_min_interval UNNEEDED, struct wireaddr **announcable UNNEEDED, u32 **dev_gossip_time UNNEEDED)
{ fprintf(stderr, "fromwire_gossipctl_init called!\n"); abort(); }
/* Generated stub for fromwire_gossip_dev_set_max_scids_encode_size */
bool fromwire_gossip_dev_set_max_scids_encode_size(const void *p UNNEEDED, u32 *max UNNEEDED)
@ -317,9 +317,6 @@ u8 *towire_hsm_node_announcement_sig_req(const tal_t *ctx UNNEEDED, const u8 *an
/* Generated stub for towire_wireaddr */
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
/* Generated stub for wireaddr_eq */
bool wireaddr_eq(const struct wireaddr *a UNNEEDED, const struct wireaddr *b UNNEEDED)
{ fprintf(stderr, "wireaddr_eq 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(); }

5
gossipd/test/run-extended-info.c

@ -77,7 +77,7 @@ bool fromwire_expiry_too_soon(const tal_t *ctx UNNEEDED, const void *p UNNEEDED,
bool fromwire_fee_insufficient(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct amount_msat *htlc_msat UNNEEDED, u8 **channel_update UNNEEDED)
{ fprintf(stderr, "fromwire_fee_insufficient called!\n"); abort(); }
/* Generated stub for fromwire_gossipctl_init */
bool fromwire_gossipctl_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct node_id *id UNNEEDED, u8 **globalfeatures UNNEEDED, u8 rgb[3] UNNEEDED, u8 alias[32] UNNEEDED, u32 *update_channel_interval UNNEEDED, struct wireaddr **announcable UNNEEDED, u32 **dev_gossip_time UNNEEDED)
bool fromwire_gossipctl_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct node_id *id UNNEEDED, u8 **globalfeatures UNNEEDED, u8 rgb[3] UNNEEDED, u8 alias[32] UNNEEDED, u32 *update_channel_interval UNNEEDED, u32 *gossip_min_interval UNNEEDED, struct wireaddr **announcable UNNEEDED, u32 **dev_gossip_time UNNEEDED)
{ fprintf(stderr, "fromwire_gossipctl_init called!\n"); abort(); }
/* Generated stub for fromwire_gossip_dev_set_max_scids_encode_size */
bool fromwire_gossip_dev_set_max_scids_encode_size(const void *p UNNEEDED, u32 *max UNNEEDED)
@ -336,9 +336,6 @@ u8 *towire_hsm_node_announcement_sig_req(const tal_t *ctx UNNEEDED, const u8 *an
/* Generated stub for towire_wireaddr */
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
/* Generated stub for wireaddr_eq */
bool wireaddr_eq(const struct wireaddr *a UNNEEDED, const struct wireaddr *b UNNEEDED)
{ fprintf(stderr, "wireaddr_eq 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(); }

2
lightningd/gossip_control.c

@ -196,6 +196,8 @@ void gossip_init(struct lightningd *ld, int connectd_fd)
get_offered_globalfeatures(tmpctx),
ld->rgb,
ld->alias, ld->config.channel_update_interval,
/* gossip_min_interval: 5x the broadcast interval */
ld->config.broadcast_interval_msec / 200,
ld->announcable,
IFDEV(ld->dev_gossip_time ? &ld->dev_gossip_time: NULL, NULL));
subd_send_msg(ld->gossip, msg);

Loading…
Cancel
Save