Skip to content

Commit 64854dc

Browse files
committed
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 <[email protected]>
1 parent 0c5c4fd commit 64854dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gossipd/gossmap_manage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,15 @@ static void remove_channel(struct gossmap_manage *gm,
320320
}
321321
}
322322

323+
/* If we don't know, we assume it's good */
323324
static u32 get_timestamp(struct gossmap *gossmap,
324325
const struct gossmap_chan *chan,
325326
int dir)
326327
{
327328
u32 timestamp;
328329

329-
/* 0 is sufficient for our needs */
330330
if (!gossmap_chan_set(chan, dir))
331-
return 0;
331+
return UINT32_MAX;
332332

333333
gossmap_chan_get_update_details(gossmap, chan, dir,
334334
&timestamp,

0 commit comments

Comments
 (0)