Skip to content

Commit

Permalink
gossipd: set dying flag on node_announcements when initially created.
Browse files Browse the repository at this point in the history
We accept node_announcements on dying channels, but make sure we
set the dying flag it channels are alll dying.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Feb 9, 2024
1 parent a84b656 commit 4857fcf
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions gossipd/gossmap_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,12 +862,15 @@ const char *gossmap_manage_channel_update(const tal_t *ctx,
}

static void process_node_announcement(struct gossmap_manage *gm,
struct gossmap *gossmap,
const struct gossmap_node *node,
u32 timestamp,
const struct node_id *node_id,
const u8 *nannounce,
const struct node_id *source_peer)
{
u64 offset;

/* Do we have a later one? If so, ignore */
if (gossmap_node_announced(node)) {
u32 prev_timestamp
Expand All @@ -879,7 +882,13 @@ static void process_node_announcement(struct gossmap_manage *gm,
}

/* OK, apply the new one */
gossip_store_add(gm->daemon->gs, nannounce, timestamp);
offset = gossip_store_add(gm->daemon->gs, nannounce, timestamp);
/* If all channels are dying, make sure this is marked too. */
if (all_node_channels_dying(gossmap, node, NULL)) {
gossip_store_set_flag(gm->daemon->gs, offset,
GOSSIP_STORE_DYING_BIT,
WIRE_NODE_ANNOUNCEMENT);
}

/* Now delete old */
if (gossmap_node_announced(node))
Expand Down Expand Up @@ -973,7 +982,7 @@ const char *gossmap_manage_node_announcement(const tal_t *ctx,
return NULL;
}

process_node_announcement(gm, node, timestamp, &node_id, nannounce, source_peer);
process_node_announcement(gm, gossmap, node, timestamp, &node_id, nannounce, source_peer);
return NULL;
}

Expand Down Expand Up @@ -1081,7 +1090,7 @@ static void reprocess_queued_msgs(struct gossmap_manage *gm)
continue;
}

process_node_announcement(gm, node,
process_node_announcement(gm, gossmap, node,
pnas[i]->timestamp,
&pnas[i]->node_id,
pnas[i]->nannounce,
Expand Down

0 comments on commit 4857fcf

Please sign in to comment.