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>
This commit is contained in:
Rusty Russell 2018-10-15 15:27:38 +10:30
parent 3991425111
commit afac01380d
5 changed files with 9 additions and 10 deletions

View File

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

1 #include <common/cryptomsg.h>
4 # Initialize the gossip daemon.
5 gossipctl_init,3000
6 gossipctl_init,,broadcast_interval,u32 gossipctl_init,,broadcast_interval_msec,u32
7 gossipctl_init,,chain_hash,struct bitcoin_blkid
8 gossipctl_init,,id,struct pubkey
9 gossipctl_init,,gflen,u16
10 gossipctl_init,,globalfeatures,gflen*u8

View File

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

View File

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

View File

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

View File

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