mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
gossipd: don't prune if we haven't seen on side's update at all.
This caused a "flake" in testing, because it's wrong: ``` _____________________________ test_gossip_pruning ______________________________ [gw2] linux -- Python 3.10.16 /home/runner/.cache/pypoetry/virtualenvs/cln-meta-project-AqJ9wMix-py3.10/bin/python node_factory = <pyln.testing.utils.NodeFactory object at 0x7f0267530490> bitcoind = <pyln.testing.utils.BitcoinD object at 0x7f0267532b30> def test_gossip_pruning(node_factory, bitcoind): """ Create channel and see it being updated in time before pruning """ l1, l2, l3 = node_factory.get_nodes(3, opts={'dev-fast-gossip-prune': None, 'allow_bad_gossip': True, 'autoconnect-seeker-peers': 0}) l1.rpc.connect(l2.info['id'], 'localhost', l2.port) l2.rpc.connect(l3.info['id'], 'localhost', l3.port) scid1, _ = l1.fundchannel(l2, 10**6) scid2, _ = l2.fundchannel(l3, 10**6) mine_funding_to_announce(bitcoind, [l1, l2, l3]) wait_for(lambda: l1.rpc.listchannels(source=l1.info['id'])['channels'] != []) l1_initial_cupdate_timestamp = only_one(l1.rpc.listchannels(source=l1.info['id'])['channels'])['last_update'] # Get timestamps of initial updates, so we can ensure they change. # Channels should be activated locally > wait_for(lambda: [c['active'] for c in l1.rpc.listchannels()['channels']] == [True] * 4) ``` Here you can see it has pruned: ``` lightningd-1 2025-01-24T07:39:40.873Z DEBUG gossipd: Pruning channel 105x1x0 from network view (ages 1737704380 and 0) ... lightningd-1 2025-01-24T07:39:50.941Z UNUSUAL lightningd: Bad gossip order: could not find channel 105x1x0 for peer's channel update ``` Changelog-Fixed: Protocol: we were overzealous in pruning channels if we hadn't seen one side's gossip update yet. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
123f8ba9d6
commit
cc2be867dc
1 changed files with 2 additions and 2 deletions
|
@ -320,15 +320,15 @@ static void remove_channel(struct gossmap_manage *gm,
|
|||
}
|
||||
}
|
||||
|
||||
/* If we don't know, we assume it's good */
|
||||
static u32 get_timestamp(struct gossmap *gossmap,
|
||||
const struct gossmap_chan *chan,
|
||||
int dir)
|
||||
{
|
||||
u32 timestamp;
|
||||
|
||||
/* 0 is sufficient for our needs */
|
||||
if (!gossmap_chan_set(chan, dir))
|
||||
return 0;
|
||||
return UINT32_MAX;
|
||||
|
||||
gossmap_chan_get_update_details(gossmap, chan, dir,
|
||||
×tamp,
|
||||
|
|
Loading…
Add table
Reference in a new issue