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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-12-07 06:44:05 +10:30
parent 1d9a6d1efa
commit f2fff4de55
2 changed files with 7 additions and 2 deletions

View File

@@ -17,6 +17,8 @@
#include <unistd.h>
#include <wire/peer_wire.h>
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);

View File

@@ -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,