gossipd: correct node_announcement order when zombifying channels

remove_chan_from_node already corrects the ordering if a node_announcement
is left ahead of the next oldest channel_announcement, but zombifying should
do that check (and reorder if necessary) too.

Changelog-None
This commit is contained in:
Alex Myers
2023-02-28 12:55:45 -06:00
committed by Alex Myers
parent f1c29aa3bd
commit 07c04d247e

View File

@@ -1507,7 +1507,7 @@ bool routing_add_channel_update(struct routing_state *rstate,
* zombie channel has a recent timestamp. */ * zombie channel has a recent timestamp. */
if (zombie && timestamp_reasonable(rstate, if (zombie && timestamp_reasonable(rstate,
chan->half[!direction].bcast.timestamp) && chan->half[!direction].bcast.timestamp) &&
chan->half[!direction].bcast.index) { chan->half[!direction].bcast.index && !index) {
status_peer_debug(peer ? &peer->id : NULL, status_peer_debug(peer ? &peer->id : NULL,
"Resurrecting zombie channel %s.", "Resurrecting zombie channel %s.",
type_to_string(tmpctx, type_to_string(tmpctx,
@@ -2030,11 +2030,19 @@ static void zombify_channel(struct gossip_store *gs, struct chan *channel)
&channel->scid)); &channel->scid));
/* If one of the nodes has no remaining active channels, forget /* If one of the nodes has no remaining active channels, forget
* the node_announcement. */ * the node_announcement. Also recheck node_announcement order. */
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
struct node *node = channel->nodes[i]; struct node *node = channel->nodes[i];
if (node_has_broadcastable_channels(node)) if (node_has_broadcastable_channels(node)) {
if (!node->bcast.index)
continue; continue;
if (node_announce_predates_channels(node)) {
/* Make sure the node announcement follows a channel
* announcement. */
force_node_announce_rexmit(rstate, node);
}
continue;
}
if (node->rgraph.index != node->bcast.index) if (node->rgraph.index != node->bcast.index)
gossip_store_delete(gs, &node->rgraph, gossip_store_delete(gs, &node->rgraph,
WIRE_NODE_ANNOUNCEMENT); WIRE_NODE_ANNOUNCEMENT);