From 28185c397ceb9d8835e85f66d6afdb028daf3866 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 27 Aug 2019 16:16:02 +0930 Subject: [PATCH] gossipd: fix gossip send in case query_flags cause no output. Fortunately, again, only happens with EXPERIMENTAL_FEATURES. If the query causes us not to actually send anything, we won't get called again. This can validly happen if they only asked for the node_announcements, for example. (Found by protocol tests). Signed-off-by: Rusty Russell --- gossipd/gossipd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index e21f4acdf..4e19f8c34 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -1507,8 +1507,10 @@ static void maybe_create_next_scid_reply(struct peer *peer) * - if bit 0 of `query_flag` is set: * - MUST reply with a `channel_announcement` */ - if (peer->scid_query_flags[i] & SCID_QF_ANNOUNCE) + if (peer->scid_query_flags[i] & SCID_QF_ANNOUNCE) { queue_peer_from_store(peer, &chan->bcast); + sent = true; + } /* BOLT-61a1365a45cc8b463ddbbe3429d350f8eac787dd #7: * - if bit 1 of `query_flag` is set and it has received a @@ -1520,11 +1522,15 @@ static void maybe_create_next_scid_reply(struct peer *peer) * - MUST reply with the latest `channel_update` for * `node_id_2` */ if ((peer->scid_query_flags[i] & SCID_QF_UPDATE1) - && is_halfchan_defined(&chan->half[0])) + && is_halfchan_defined(&chan->half[0])) { queue_peer_from_store(peer, &chan->half[0].bcast); + sent = true; + } if ((peer->scid_query_flags[i] & SCID_QF_UPDATE2) - && is_halfchan_defined(&chan->half[1])) + && is_halfchan_defined(&chan->half[1])) { queue_peer_from_store(peer, &chan->half[1].bcast); + sent = true; + } /* BOLT-61a1365a45cc8b463ddbbe3429d350f8eac787dd #7: * - if bit 3 of `query_flag` is set and it has received @@ -1542,7 +1548,6 @@ static void maybe_create_next_scid_reply(struct peer *peer) if (peer->scid_query_flags[i] & SCID_QF_NODE2) tal_arr_expand(&peer->scid_query_nodes, chan->nodes[1]->id); - sent = true; } /* Just finished channels? Remove duplicate nodes. */