Browse Source

gossipd: don't initialize broadcast interval, make field name explicit.

We initialize it to 30 seconds, but it's *always* overridden by the
gossip_init message (and usually to 60 seconds, so it's doubly
misleading).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
fee-tracking2
Rusty Russell 6 years ago
parent
commit
afac01380d
  1. 2
      gossipd/gossip_wire.csv
  2. 7
      gossipd/gossipd.c
  3. 2
      lightningd/gossip_control.c
  4. 2
      lightningd/lightningd.h
  5. 6
      lightningd/options.c

2
gossipd/gossip_wire.csv

@ -4,7 +4,7 @@
# Initialize the gossip daemon.
gossipctl_init,3000
gossipctl_init,,broadcast_interval,u32
gossipctl_init,,broadcast_interval_msec,u32
gossipctl_init,,chain_hash,struct bitcoin_blkid
gossipctl_init,,id,struct pubkey
gossipctl_init,,gflen,u16

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

7
gossipd/gossipd.c

@ -80,7 +80,7 @@ struct daemon {
struct timers timers;
u32 broadcast_interval;
u32 broadcast_interval_msec;
/* Global features to list in node_announcement. */
u8 *globalfeatures;
@ -929,7 +929,7 @@ static bool maybe_queue_gossip(struct peer *peer)
/* Gossip is drained. Wait for next timer. */
peer->gossip_timer
= new_reltimer(&peer->daemon->timers, peer,
time_from_msec(peer->daemon->broadcast_interval),
time_from_msec(peer->daemon->broadcast_interval_msec),
wake_gossip_out, peer);
return false;
}
@ -1818,7 +1818,7 @@ static struct io_plan *gossip_init(struct daemon_conn *master,
u32 update_channel_interval;
if (!fromwire_gossipctl_init(
daemon, msg, &daemon->broadcast_interval, &chain_hash,
daemon, msg, &daemon->broadcast_interval_msec, &chain_hash,
&daemon->id, &daemon->globalfeatures,
daemon->rgb,
daemon->alias, &update_channel_interval,
@ -2140,7 +2140,6 @@ int main(int argc, char *argv[])
daemon = tal(NULL, struct daemon);
list_head_init(&daemon->peers);
timers_init(&daemon->timers, time_mono());
daemon->broadcast_interval = 30000;
daemon->last_announce_timestamp = 0;
/* stdin == control */

2
lightningd/gossip_control.c

@ -161,7 +161,7 @@ void gossip_init(struct lightningd *ld, int connectd_fd)
err(1, "Could not subdaemon gossip");
msg = towire_gossipctl_init(
tmpctx, ld->config.broadcast_interval,
tmpctx, ld->config.broadcast_interval_msec,
&get_chainparams(ld)->genesis_blockhash, &ld->id,
get_offered_globalfeatures(tmpctx),
ld->rgb,

2
lightningd/lightningd.h

@ -46,7 +46,7 @@ struct config {
u32 commit_time_ms;
/* How often to broadcast gossip (msec) */
u32 broadcast_interval;
u32 broadcast_interval_msec;
/* Channel update interval */
u32 channel_update_interval;

6
lightningd/options.c

@ -405,7 +405,7 @@ static void dev_register_opts(struct lightningd *ld)
opt_register_arg("--dev-debugger=<subdaemon>", opt_subd_debug, NULL,
ld, "Invoke gdb at start of <subdaemon>");
opt_register_arg("--dev-broadcast-interval=<ms>", opt_set_uintval,
opt_show_uintval, &ld->config.broadcast_interval,
opt_show_uintval, &ld->config.broadcast_interval_msec,
"Time between gossip broadcasts in milliseconds");
opt_register_arg("--dev-disconnect=<filename>", opt_subd_dev_disconnect,
NULL, ld, "File containing disconnection points");
@ -465,7 +465,7 @@ static const struct config testnet_config = {
* - SHOULD flush outgoing gossip messages once every 60
* seconds, independently of the arrival times of the messages.
*/
.broadcast_interval = 60000,
.broadcast_interval_msec = 60000,
/* Send a keepalive update at least every week, prune every twice that */
.channel_update_interval = 1209600/2,
@ -528,7 +528,7 @@ static const struct config mainnet_config = {
* - SHOULD flush outgoing gossip messages once every 60
* seconds, independently of the arrival times of the messages.
*/
.broadcast_interval = 60000,
.broadcast_interval_msec = 60000,
/* Send a keepalive update at least every week, prune every twice that */
.channel_update_interval = 1209600/2,

Loading…
Cancel
Save