mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +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:
parent
f81a7ff792
commit
c110d0b068
2 changed files with 14 additions and 1 deletions
|
@ -356,11 +356,19 @@ static void force_self_nannounce_regen(struct daemon *daemon)
|
|||
* 24 hours. */
|
||||
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);
|
||||
daemon->node_announce_regen_timer
|
||||
= new_reltimer(&daemon->timers,
|
||||
daemon,
|
||||
time_from_sec(24 * 3600),
|
||||
regen_time,
|
||||
force_self_nannounce_regen,
|
||||
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 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)
|
||||
l1.daemon.wait_for_logs([
|
||||
'Sending keepalive channel_update for {}'.format(scid1),
|
||||
|
|
Loading…
Add table
Reference in a new issue