Files
lightning/common/gossip_store.h
Rusty Russell df00f20e4a gossipd: erase old entries from the store, don't just append.
We use the high bit of the length field: this way we can still check
that the checksums are valid on deleted fields.

Once this is done, serially reading the gossip_store file will result
in a complete, ordered, minimal gossip broadcast.  Also, the horrible
corner case where we might try to delete things from the store during
load time is completely gone: we only load non-deleted things.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-06-04 01:29:39 +00:00

25 lines
603 B
C

#ifndef LIGHTNING_COMMON_GOSSIP_STORE_H
#define LIGHTNING_COMMON_GOSSIP_STORE_H
#include "config.h"
#include <ccan/short_types/short_types.h>
#include <ccan/tal/tal.h>
/**
* gossip_store -- On-disk storage related information
*/
#define GOSSIP_STORE_VERSION 5
/**
* Bit of length we use to mark a deleted record.
*/
#define GOSSIP_STORE_LEN_DELETED_BIT 0x80000000U
/**
* Direct store accessor: loads gossip msg from store.
*
* Doesn't return; status_failed() on error.
*/
u8 *gossip_store_read(const tal_t *ctx, int gossip_store_fd, u64 offset);
#endif /* LIGHTNING_COMMON_GOSSIP_STORE_H */