core-lightning/common/gossip_store.h
Rusty Russell 5591c0b5d8 gossipd: don't send gossip stream, let per-peer daemons read it themselves.
Keeping the uintmap ordering all the broadcastable messages is expensive:
130MB for the million-channels project.  But now we delete obsolete entries
from the store, we can have the per-peer daemons simply read that sequentially
and stream the gossip itself.

This is the most primitive version, where all gossip is streamed;
successive patches will bring back proper handling of timestamp filtering
and initial_routing_sync.

We add a gossip_state field to track what's happening with our gossip
streaming: it's initialized in gossipd, and currently always set, but
once we handle timestamps the per-peer daemon may do it when the first
filter is sent.

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

34 lines
835 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>
struct per_peer_state;
/**
* 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.
*
* Returns NULL and resets time_to_next_gossip(pps) if there are no
* more gossip msgs.
*/
u8 *gossip_store_next(const tal_t *ctx, struct per_peer_state *pps);
/**
* Switches the gossip store fd, and gets to the correct offset.
*/
void gossip_store_switch_fd(struct per_peer_state *pps,
int newfd, u64 offset_shorter);
#endif /* LIGHTNING_COMMON_GOSSIP_STORE_H */