gossip_store: add a flag for zombie entries

This will allow gossipd to store and persist gossip for channels rather
than deleting them entirely when the channels are pruned from the
network.
This commit is contained in:
Alex Myers
2022-12-16 10:25:47 -06:00
committed by Rusty Russell
parent ed4815527a
commit 6bff10cd40
8 changed files with 39 additions and 25 deletions

View File

@@ -12,7 +12,7 @@
/* Current versions we support */
#define GSTORE_MAJOR 0
#define GSTORE_MINOR 10
#define GSTORE_MINOR 12
int main(int argc, char *argv[])
{
@@ -67,12 +67,13 @@ int main(int argc, char *argv[])
struct short_channel_id scid;
u32 msglen = be32_to_cpu(hdr.len);
u8 *msg, *inner;
bool deleted, push, ratelimit;
bool deleted, push, ratelimit, zombie;
u32 blockheight;
deleted = (msglen & GOSSIP_STORE_LEN_DELETED_BIT);
push = (msglen & GOSSIP_STORE_LEN_PUSH_BIT);
ratelimit = (msglen & GOSSIP_STORE_LEN_RATELIMIT_BIT);
zombie = (msglen & GOSSIP_STORE_LEN_ZOMBIE_BIT);
msglen &= GOSSIP_STORE_LEN_MASK;
msg = tal_arr(NULL, u8, msglen);
@@ -83,10 +84,11 @@ int main(int argc, char *argv[])
!= crc32c(be32_to_cpu(hdr.timestamp), msg, msglen))
warnx("Checksum verification failed");
printf("%zu: %s%s%s", off,
printf("%zu: %s%s%s%s", off,
deleted ? "DELETED " : "",
push ? "PUSH " : "",
ratelimit ? "RATE-LIMITED " : "");
ratelimit ? "RATE-LIMITED " : "",
zombie ? "ZOMBIE " : "");
if (print_timestamp)
printf("T=%u ", be32_to_cpu(hdr.timestamp));
if (deleted && !print_deleted) {