Skip to content

Commit

Permalink
gossipd: fix bogus message when dying channel is pruned.
Browse files Browse the repository at this point in the history
```
2025-01-23T12:31:52.528Z DEBUG   gossipd: Pruning channel 839050x1246x0 from network view (ages 1736283379 and 1737600120)
2025-01-27T00:32:01.631Z DEBUG   gossipd: Pruning channel 839050x1246x0 from network view (ages 0 and 1737686520)
2025-01-27T00:50:05.998Z **BROKEN** gossipd: Dying channel 839050x1246x0 already deleted?
```

Easiest not to prune in this case.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and endothermicdev committed Feb 11, 2025
1 parent 2b4b147 commit d554206
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions gossipd/gossmap_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,16 @@ static u32 get_timestamp(struct gossmap *gossmap,
return timestamp;
}

static bool channel_already_dying(const struct chan_dying dying_channels[],
struct short_channel_id scid)
{
for (size_t i = 0; i < tal_count(dying_channels); i++) {
if (short_channel_id_eq(dying_channels[i].scid, scid))
return true;
}
return false;
}

/* Every half a week we look for dead channels (faster in dev) */
static void prune_network(struct gossmap_manage *gm)
{
Expand Down Expand Up @@ -379,6 +389,10 @@ static void prune_network(struct gossmap_manage *gm)

scid = gossmap_chan_scid(gossmap, chan);

/* If it's dying anyway, don't bother pruning. */
if (channel_already_dying(gm->dying_channels, scid))
continue;

/* Is it one of mine? */
if (gossmap_nth_node(gossmap, chan, 0) == me
|| gossmap_nth_node(gossmap, chan, 1) == me) {
Expand Down Expand Up @@ -1306,10 +1320,8 @@ void gossmap_manage_channel_spent(struct gossmap_manage *gm,
}

/* Is it already dying? It's lightningd re-telling us */
for (size_t i = 0; i < tal_count(gm->dying_channels); i++) {
if (short_channel_id_eq(gm->dying_channels[i].scid, scid))
return;
}
if (channel_already_dying(gm->dying_channels, scid))
return;

/* BOLT #7:
* - once its funding output has been spent OR reorganized out:
Expand Down

0 comments on commit d554206

Please sign in to comment.