mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 09:04:22 +01:00
pytest: test that node_announcement regeneration works as expected.
We shorten 24 hours to 24 seconds using --dev--fast-gossip-prune. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -356,11 +356,19 @@ static void force_self_nannounce_regen(struct daemon *daemon)
|
|||||||
* 24 hours. */
|
* 24 hours. */
|
||||||
static void setup_force_nannounce_regen_timer(struct daemon *daemon)
|
static void setup_force_nannounce_regen_timer(struct daemon *daemon)
|
||||||
{
|
{
|
||||||
|
struct timerel regen_time;
|
||||||
|
|
||||||
|
/* For developers we can force a regen every 24 seconds to test */
|
||||||
|
if (IFDEV(daemon->rstate->dev_fast_gossip_prune, false))
|
||||||
|
regen_time = time_from_sec(24);
|
||||||
|
else
|
||||||
|
regen_time = time_from_sec(24 * 3600);
|
||||||
|
|
||||||
tal_free(daemon->node_announce_regen_timer);
|
tal_free(daemon->node_announce_regen_timer);
|
||||||
daemon->node_announce_regen_timer
|
daemon->node_announce_regen_timer
|
||||||
= new_reltimer(&daemon->timers,
|
= new_reltimer(&daemon->timers,
|
||||||
daemon,
|
daemon,
|
||||||
time_from_sec(24 * 3600),
|
regen_time,
|
||||||
force_self_nannounce_regen,
|
force_self_nannounce_regen,
|
||||||
daemon);
|
daemon);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ def test_gossip_pruning(node_factory, bitcoind):
|
|||||||
wait_for(lambda: [c['active'] for c in l2.rpc.listchannels()['channels']] == [True] * 4)
|
wait_for(lambda: [c['active'] for c in l2.rpc.listchannels()['channels']] == [True] * 4)
|
||||||
wait_for(lambda: [c['active'] for c in l3.rpc.listchannels()['channels']] == [True] * 4)
|
wait_for(lambda: [c['active'] for c in l3.rpc.listchannels()['channels']] == [True] * 4)
|
||||||
|
|
||||||
|
# Also check that it sends a redundant node_announcement.
|
||||||
|
ts1 = only_one(l2.rpc.listnodes(l1.info['id'])['nodes'])['last_timestamp']
|
||||||
|
wait_for(lambda: only_one(l2.rpc.listnodes(l1.info['id'])['nodes'])['last_timestamp'] != ts1)
|
||||||
|
assert only_one(l2.rpc.listnodes(l1.info['id'])['nodes'])['last_timestamp'] >= ts1 + 24
|
||||||
|
|
||||||
# All of them should send a keepalive message (after 30 seconds)
|
# All of them should send a keepalive message (after 30 seconds)
|
||||||
l1.daemon.wait_for_logs([
|
l1.daemon.wait_for_logs([
|
||||||
'Sending keepalive channel_update for {}'.format(scid1),
|
'Sending keepalive channel_update for {}'.format(scid1),
|
||||||
|
|||||||
Reference in New Issue
Block a user