Browse Source

gossip: fix default broadcast interval, move option.

This now makes a few more gossip tests time out without --dev-broadcast-interval

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
7e0bc88e2a
  1. 2
      lightningd/gossip_control.c
  2. 4
      lightningd/lightningd.c
  3. 5
      lightningd/lightningd.h
  4. 12
      lightningd/options.c
  5. 2
      tests/test_lightningd.py

2
lightningd/gossip_control.c

@ -128,7 +128,7 @@ void gossip_init(struct lightningd *ld)
if (!ld->gossip)
err(1, "Could not subdaemon gossip");
msg = towire_gossipctl_init(tmpctx, ld->broadcast_interval,
msg = towire_gossipctl_init(tmpctx, ld->config.broadcast_interval,
&get_chainparams(ld)->genesis_blockhash,
&ld->id, ld->portnum,
get_supported_global_features(tmpctx),

4
lightningd/lightningd.c

@ -267,10 +267,6 @@ int main(int argc, char *argv[])
register_opts(ld);
/* FIXME: move to option initialization once we drop the
* legacy daemon */
ld->broadcast_interval = 30000;
/* Handle options and config; move to .lightningd */
newdir = handle_opts(ld, argc, argv);

5
lightningd/lightningd.h

@ -66,6 +66,9 @@ struct config {
/* How long between changing commit and sending COMMIT message. */
struct timerel commit_time;
/* How often to broadcast gossip (msec) */
u32 broadcast_interval;
/* Disable automatic reconnects */
bool no_reconnect;
};
@ -122,8 +125,6 @@ struct lightningd {
struct htlc_in_map htlcs_in;
struct htlc_out_map htlcs_out;
u32 broadcast_interval;
struct wallet *wallet;
/* Maintained by invoices.c */

12
lightningd/options.c

@ -290,8 +290,8 @@ static void dev_register_opts(struct lightningd *ld)
opt_register_arg("--dev-debugger=<subdaemon>", opt_subd_debug, NULL,
ld, "Wait for gdb attach at start of <subdaemon>");
opt_register_arg("--dev-broadcast-interval=<ms>", opt_set_uintval,
opt_show_uintval, &ld->broadcast_interval,
"Time between gossip broadcasts in milliseconds (default: 30000)");
opt_show_uintval, &ld->config.broadcast_interval,
"Time between gossip broadcasts in milliseconds");
opt_register_arg("--dev-disconnect=<filename>", opt_subd_dev_disconnect,
NULL, ld, "File containing disconnection points");
opt_register_arg("--dev-hsm-seed=<seed>", opt_set_hsm_seed,
@ -351,6 +351,10 @@ static const struct config testnet_config = {
/* Take 0.001% */
.fee_per_satoshi = 10,
/* BOLT #7:
* Each node SHOULD flush outgoing announcements once every 60 seconds */
.broadcast_interval = 60000,
/* Automatically reconnect */
.no_reconnect = false,
};
@ -416,6 +420,10 @@ static const struct config mainnet_config = {
/* Take 0.001% */
.fee_per_satoshi = 10,
/* BOLT #7:
* Each node SHOULD flush outgoing announcements once every 60 seconds */
.broadcast_interval = 60000,
/* Automatically reconnect */
.no_reconnect = false,
};

2
tests/test_lightningd.py

@ -2415,6 +2415,7 @@ class LightningDTests(BaseLightningDTests):
# L1 must notice.
l1.daemon.wait_for_log('-> ONCHAIND_THEIR_UNILATERAL')
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1 for --dev-broadcast-interval")
def test_gossip_badsig(self):
l1 = self.node_factory.get_node()
l2 = self.node_factory.get_node()
@ -2533,6 +2534,7 @@ class LightningDTests(BaseLightningDTests):
r = self.executor.submit(l2.rpc.waitanyinvoice, pay_index).result(timeout=5)
assert r['label'] == 'inv1'
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1 for --dev-broadcast-interval")
def test_channel_reenable(self):
l1, l2 = self.line_graph(n=2)

Loading…
Cancel
Save