Skip to content

Commit 7ad3192

Browse files
committed
gossipd: fix bogus message when dying channel is pruned.
``` 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]>
1 parent ff21e63 commit 7ad3192

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

gossipd/gossmap_manage.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,16 @@ static u32 get_timestamp(struct gossmap *gossmap,
342342
return timestamp;
343343
}
344344

345+
static bool channel_already_dying(const struct chan_dying dying_channels[],
346+
struct short_channel_id scid)
347+
{
348+
for (size_t i = 0; i < tal_count(dying_channels); i++) {
349+
if (short_channel_id_eq(dying_channels[i].scid, scid))
350+
return true;
351+
}
352+
return false;
353+
}
354+
345355
/* Every half a week we look for dead channels (faster in dev) */
346356
static void prune_network(struct gossmap_manage *gm)
347357
{
@@ -379,6 +389,10 @@ static void prune_network(struct gossmap_manage *gm)
379389

380390
scid = gossmap_chan_scid(gossmap, chan);
381391

392+
/* If it's dying anyway, don't bother pruning. */
393+
if (channel_already_dying(gm->dying_channels, scid))
394+
continue;
395+
382396
/* Is it one of mine? */
383397
if (gossmap_nth_node(gossmap, chan, 0) == me
384398
|| gossmap_nth_node(gossmap, chan, 1) == me) {
@@ -1290,10 +1304,8 @@ void gossmap_manage_channel_spent(struct gossmap_manage *gm,
12901304
}
12911305

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

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

0 commit comments

Comments
 (0)