gossipd: don't gather dying channels during compaction.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2026-02-12 09:21:10 +10:30
parent 900fd08455
commit dfc4ce21de
3 changed files with 5 additions and 28 deletions

View File

@@ -199,8 +199,7 @@ static u8 *new_uuid_record(const tal_t *ctx, int fd, u64 *off)
*/
static int gossip_store_compact(struct daemon *daemon,
u64 *total_len,
bool *populated,
struct chan_dying **dying)
bool *populated)
{
size_t cannounces = 0, cupdates = 0, nannounces = 0, deleted = 0;
int old_fd, new_fd;
@@ -324,20 +323,6 @@ static int gossip_store_compact(struct daemon *daemon,
case WIRE_CHANNEL_ANNOUNCEMENT:
cannounces++;
break;
case WIRE_GOSSIP_STORE_CHAN_DYING: {
struct chan_dying cd;
if (!fromwire_gossip_store_chan_dying(msg,
&cd.scid,
&cd.deadline)) {
bad = "Bad gossip_store_chan_dying";
goto badmsg;
}
/* By convention, these offsets are *after* header */
cd.gossmap_offset = *total_len + sizeof(hdr);
tal_arr_expand(dying, cd);
break;
}
case WIRE_CHANNEL_UPDATE:
cupdates++;
break;
@@ -421,14 +406,12 @@ void gossip_store_corrupt(void)
struct gossip_store *gossip_store_new(const tal_t *ctx,
struct daemon *daemon,
bool *populated,
struct chan_dying **dying)
bool *populated)
{
struct gossip_store *gs = tal(ctx, struct gossip_store);
gs->daemon = daemon;
*dying = tal_arr(ctx, struct chan_dying, 0);
gs->fd = gossip_store_compact(daemon, &gs->len, populated, dying);
gs->fd = gossip_store_compact(daemon, &gs->len, populated);
if (gs->fd < 0)
return tal_free(gs);
tal_add_destructor(gs, gossip_store_destroy);

View File

@@ -27,14 +27,12 @@ struct chan_dying {
* @ctx: the context to allocate from
* @daemon: the daemon context
* @populated: set to false if store is empty/obviously partial.
* @dying: an array of channels we found dying markers for.
*
* Returns NULL on error.
*/
struct gossip_store *gossip_store_new(const tal_t *ctx,
struct daemon *daemon,
bool *populated,
struct chan_dying **dying);
bool *populated);
/**
* Move the old gossip store out the way. Log a broken message about it.

View File

@@ -459,7 +459,6 @@ static bool setup_gossmap(struct gossmap_manage *gm,
struct daemon *daemon)
{
u64 expected_len;
struct chan_dying *dying = NULL;
gm->dying_channels = tal_arr(gm, struct chan_dying, 0);
@@ -467,13 +466,10 @@ static bool setup_gossmap(struct gossmap_manage *gm,
* necessary */
gm->gs = gossip_store_new(gm,
daemon,
&gm->gossip_store_populated,
&dying);
&gm->gossip_store_populated);
if (!gm->gs)
return false;
/* FIXME: Remove */
tal_free(dying);
expected_len = gossip_store_len_written(gm->gs);
/* This actually loads it into memory, with strict checks. */