Skip to content

Commit

Permalink
gossipd: fix gossip send in case query_flags cause no output.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed Aug 27, 2019
1 parent 855dff7 commit 28185c3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions gossipd/gossipd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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. */
Expand Down

0 comments on commit 28185c3

Please sign in to comment.