From 63b622ec62264c6e2ec7c97d76fd0d25fd3eb3d3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 19 Jul 2023 06:36:22 +0930 Subject: [PATCH] gossipd: clean up dump_our_gossip. Alex and I were reading it and I got confused: it's really a simpler loop than it seems, with all those redundant `continue` statements. Signed-off-by: Rusty Russell --- gossipd/gossipd.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index fd0a70627..524602221 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -443,22 +443,19 @@ static void dump_our_gossip(struct daemon *daemon, struct peer *peer) if (!is_chan_public(chan)) { /* Don't leak private channels, unless it's with you! */ - if (!node_id_eq(&chan->nodes[!dir]->id, &peer->id)) - continue; - /* There's no announce for this, of course! */ - /* Private channel updates are wrapped in the store. */ - else { - if (!is_halfchan_defined(&chan->half[dir])) - continue; + if (node_id_eq(&chan->nodes[!dir]->id, &peer->id) + && is_halfchan_defined(&chan->half[dir])) { + /* There's no announce for this, of course! */ + /* Private channel updates are wrapped in the store. */ queue_priv_update(peer, &chan->half[dir].bcast); - continue; } - } else { - /* Send announce */ - queue_peer_from_store(peer, &chan->bcast); + continue; } - /* Send update if we have one */ + /* Send channel_announce */ + queue_peer_from_store(peer, &chan->bcast); + + /* Send channel_update if we have one */ if (is_halfchan_defined(&chan->half[dir])) queue_peer_from_store(peer, &chan->half[dir].bcast); }