mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
gossipd: get gossip_min_interval from lightningd.
Default is 5 x gossip interval == 5 minutes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
4cfd0524eb
commit
178baeba6c
5 changed files with 11 additions and 8 deletions
|
@ -11,6 +11,7 @@ msgdata,gossipctl_init,globalfeatures,u8,gflen
|
||||||
msgdata,gossipctl_init,rgb,u8,3
|
msgdata,gossipctl_init,rgb,u8,3
|
||||||
msgdata,gossipctl_init,alias,u8,32
|
msgdata,gossipctl_init,alias,u8,32
|
||||||
msgdata,gossipctl_init,update_channel_interval,u32,
|
msgdata,gossipctl_init,update_channel_interval,u32,
|
||||||
|
msgdata,gossipctl_init,gossip_min_interval,u32,
|
||||||
msgdata,gossipctl_init,num_announcable,u16,
|
msgdata,gossipctl_init,num_announcable,u16,
|
||||||
msgdata,gossipctl_init,announcable,wireaddr,num_announcable
|
msgdata,gossipctl_init,announcable,wireaddr,num_announcable
|
||||||
msgdata,gossipctl_init,dev_gossip_time,?u32,
|
msgdata,gossipctl_init,dev_gossip_time,?u32,
|
||||||
|
|
Can't render this file because it has a wrong number of fields in line 6.
|
|
@ -133,6 +133,9 @@ struct daemon {
|
||||||
/* Timers: we batch gossip, and also refresh announcements */
|
/* Timers: we batch gossip, and also refresh announcements */
|
||||||
struct timers timers;
|
struct timers timers;
|
||||||
|
|
||||||
|
/* Minimum interval for generating updated gossip */
|
||||||
|
u32 gossip_min_interval;
|
||||||
|
|
||||||
/* Global features to list in node_announcement. */
|
/* Global features to list in node_announcement. */
|
||||||
u8 *globalfeatures;
|
u8 *globalfeatures;
|
||||||
|
|
||||||
|
@ -2475,6 +2478,9 @@ static struct io_plan *gossip_init(struct io_conn *conn,
|
||||||
/* 1 week in seconds
|
/* 1 week in seconds
|
||||||
* (unless --dev-channel-update-interval) */
|
* (unless --dev-channel-update-interval) */
|
||||||
&update_channel_interval,
|
&update_channel_interval,
|
||||||
|
/* 5 minutes, or
|
||||||
|
* --dev-broadcast-interval * 5 seconds */
|
||||||
|
&daemon->gossip_min_interval,
|
||||||
&daemon->announcable,
|
&daemon->announcable,
|
||||||
&dev_gossip_time)) {
|
&dev_gossip_time)) {
|
||||||
master_badmsg(WIRE_GOSSIPCTL_INIT, msg);
|
master_badmsg(WIRE_GOSSIPCTL_INIT, msg);
|
||||||
|
|
|
@ -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)
|
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(); }
|
{ fprintf(stderr, "fromwire_fee_insufficient called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_gossipctl_init */
|
/* 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(); }
|
{ fprintf(stderr, "fromwire_gossipctl_init called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_gossip_dev_set_max_scids_encode_size */
|
/* 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)
|
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 */
|
/* Generated stub for towire_wireaddr */
|
||||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
{ 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 */
|
/* Generated stub for wire_sync_read */
|
||||||
u8 *wire_sync_read(const tal_t *ctx UNNEEDED, int fd UNNEEDED)
|
u8 *wire_sync_read(const tal_t *ctx UNNEEDED, int fd UNNEEDED)
|
||||||
{ fprintf(stderr, "wire_sync_read called!\n"); abort(); }
|
{ fprintf(stderr, "wire_sync_read called!\n"); abort(); }
|
||||||
|
|
|
@ -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)
|
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(); }
|
{ fprintf(stderr, "fromwire_fee_insufficient called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_gossipctl_init */
|
/* 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(); }
|
{ fprintf(stderr, "fromwire_gossipctl_init called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_gossip_dev_set_max_scids_encode_size */
|
/* 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)
|
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 */
|
/* Generated stub for towire_wireaddr */
|
||||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
{ 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 */
|
/* Generated stub for wire_sync_read */
|
||||||
u8 *wire_sync_read(const tal_t *ctx UNNEEDED, int fd UNNEEDED)
|
u8 *wire_sync_read(const tal_t *ctx UNNEEDED, int fd UNNEEDED)
|
||||||
{ fprintf(stderr, "wire_sync_read called!\n"); abort(); }
|
{ fprintf(stderr, "wire_sync_read called!\n"); abort(); }
|
||||||
|
|
|
@ -196,6 +196,8 @@ void gossip_init(struct lightningd *ld, int connectd_fd)
|
||||||
get_offered_globalfeatures(tmpctx),
|
get_offered_globalfeatures(tmpctx),
|
||||||
ld->rgb,
|
ld->rgb,
|
||||||
ld->alias, ld->config.channel_update_interval,
|
ld->alias, ld->config.channel_update_interval,
|
||||||
|
/* gossip_min_interval: 5x the broadcast interval */
|
||||||
|
ld->config.broadcast_interval_msec / 200,
|
||||||
ld->announcable,
|
ld->announcable,
|
||||||
IFDEV(ld->dev_gossip_time ? &ld->dev_gossip_time: NULL, NULL));
|
IFDEV(ld->dev_gossip_time ? &ld->dev_gossip_time: NULL, NULL));
|
||||||
subd_send_msg(ld->gossip, msg);
|
subd_send_msg(ld->gossip, msg);
|
||||||
|
|
Loading…
Add table
Reference in a new issue