From f9e0fb0055dba1b61f4153ab42f789741b5d945c Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 30 Oct 2023 10:03:35 +1030 Subject: [PATCH 1/2] gossipd: don't blanket disable channels on startup. This should only have an effect if someone queries, but in practice, peers actually see the disabling of channels. This is a workaround until we rework the code so gossipd doesn't generate these at all any more. Signed-off-by: Rusty Russell --- gossipd/gossipd.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index e681a56b19ee..33bf8cda70c6 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -814,22 +814,6 @@ static void tell_master_local_cupdates(struct daemon *daemon) } } -/* Disables all channels connected to our node. */ -static void gossip_disable_local_channels(struct daemon *daemon) -{ - struct node *local_node = get_node(daemon->rstate, &daemon->id); - struct chan_map_iter i; - struct chan *c; - - /* We don't have a local_node, so we don't have any channels yet - * either */ - if (!local_node) - return; - - for (c = first_chan(local_node, &i); c; c = next_chan(local_node, &i)) - local_disable_chan(daemon, c, half_chan_idx(local_node, c)); -} - struct peer *first_random_peer(struct daemon *daemon, struct peer_node_id_map_iter *it) { @@ -897,9 +881,6 @@ static void gossip_init(struct daemon *daemon, const u8 *msg) if (daemon->rstate->last_timestamp > timestamp) daemon->rstate->last_timestamp = timestamp; - /* Now disable all local channels, they can't be connected yet. */ - gossip_disable_local_channels(daemon); - /* If that announced channels, we can announce ourselves (options * or addresses might have changed!) */ maybe_send_own_node_announce(daemon, true); From 7f5ac1374c87777821f7908a0252844b9571cfae Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 30 Oct 2023 10:03:40 +1030 Subject: [PATCH 2/2] gossipd: never regard our own updates as spam. If we ever re-enabled a channel too fast, if we considered it spam it wouldn't propagate. For the moment, consider our own updates to never be spam. Signed-off-by: Rusty Russell --- gossipd/routing.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gossipd/routing.c b/gossipd/routing.c index 3c930637313f..adedcb6c8b72 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -1471,8 +1471,10 @@ bool routing_add_channel_update(struct routing_state *rstate, } /* Make sure it's not spamming us (private channel - * updates are never considered spam) */ + * updates are never considered spam, nor is anything + * we send ourselves!) */ if (is_chan_public(chan) + && !local_direction(rstate, chan, NULL) && !ratelimit(rstate, &hc->tokens, hc->bcast.timestamp, timestamp)) { status_peer_debug(source_peer,