Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gossip store double delete fix #7073

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion gossipd/gossmap_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ static void remove_channel(struct gossmap_manage *gm,

node = gossmap_nth_node(gossmap, chan, dir);

/* Don't get confused if a node has a channel with self! */
if (dir == 1 && node == gossmap_nth_node(gossmap, chan, 0))
continue;

/* If there was a node announcement, we might need to fix things up. */
if (!gossmap_node_announced(node))
continue;
Expand Down Expand Up @@ -1146,7 +1150,6 @@ static void kill_spent_channel(struct gossmap_manage *gm,
void gossmap_manage_new_block(struct gossmap_manage *gm, u32 new_blockheight)
{
u64 idx;
struct gossmap *gossmap = gossmap_manage_get_gossmap(gm);

for (struct pending_cannounce *pca = uintmap_first(&gm->early_ann_map.map, &idx);
pca != NULL;
Expand Down Expand Up @@ -1176,9 +1179,14 @@ void gossmap_manage_new_block(struct gossmap_manage *gm, u32 new_blockheight)
}

for (size_t i = 0; i < tal_count(gm->dying_channels); i++) {
struct gossmap *gossmap;

if (gm->dying_channels[i].deadline > new_blockheight)
continue;

/* Refresh gossmap each time in case we move things in the loop:
* in particular, we might move a node_announcement twice! */
gossmap = gossmap_manage_get_gossmap(gm);
kill_spent_channel(gm, gossmap, gm->dying_channels[i].scid);
gossip_store_del(gm->daemon->gs,
gm->dying_channels[i].gossmap_offset,
Expand Down
Loading