From f2fff4de5561ba4c4b637e2400a1c644343e681a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 7 Dec 2023 06:44:05 +1030 Subject: [PATCH] gossmap: insert temporary per-caller flag to turn off private gossip. This lets us convert one user at a time. Signed-off-by: Rusty Russell --- common/gossmap.c | 6 ++++-- common/gossmap.h | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/common/gossmap.c b/common/gossmap.c index 4495574cf..5c54dd835 100644 --- a/common/gossmap.c +++ b/common/gossmap.c @@ -17,6 +17,8 @@ #include #include +bool gossmap_public_only; + /* We need this global to decode indexes for hash functions */ static struct gossmap *map; @@ -636,11 +638,11 @@ static bool map_catchup(struct gossmap *map, size_t *num_rejected) type = map_be16(map, off); if (type == WIRE_CHANNEL_ANNOUNCEMENT) add_channel(map, off, false); - else if (type == WIRE_GOSSIP_STORE_PRIVATE_CHANNEL) + else if (type == WIRE_GOSSIP_STORE_PRIVATE_CHANNEL && !gossmap_public_only) add_channel(map, off + 2 + 8 + 2, true); else if (type == WIRE_CHANNEL_UPDATE) num_bad += !update_channel(map, off); - else if (type == WIRE_GOSSIP_STORE_PRIVATE_UPDATE) + else if (type == WIRE_GOSSIP_STORE_PRIVATE_UPDATE && !gossmap_public_only) num_bad += !update_channel(map, off + 2 + 2); else if (type == WIRE_GOSSIP_STORE_DELETE_CHAN) remove_channel_by_deletemsg(map, off); diff --git a/common/gossmap.h b/common/gossmap.h index b173c9bd5..19f87d0e4 100644 --- a/common/gossmap.h +++ b/common/gossmap.h @@ -40,6 +40,9 @@ struct gossmap_chan { } half[2]; }; +/* Temporary flag for testing: don't load private gossip info! */ +extern bool gossmap_public_only; + /* If num_channel_updates_rejected is not NULL, indicates how many channels we * marked inactive because their values were too high to be represented. */ struct gossmap *gossmap_load(const tal_t *ctx, const char *filename,