2018-03-26 02:05:34 +02:00
|
|
|
#ifndef LIGHTNING_GOSSIPD_GOSSIP_STORE_H
|
|
|
|
#define LIGHTNING_GOSSIPD_GOSSIP_STORE_H
|
2018-03-13 12:08:03 +01:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2018-03-28 12:54:09 +02:00
|
|
|
#include <bitcoin/short_channel_id.h>
|
2018-03-13 12:08:03 +01:00
|
|
|
#include <ccan/short_types/short_types.h>
|
|
|
|
#include <ccan/tal/tal.h>
|
2018-03-23 17:34:11 +01:00
|
|
|
#include <gossipd/routing.h>
|
2018-03-13 12:08:03 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gossip_store -- On-disk storage related information
|
|
|
|
*/
|
2018-09-21 02:31:45 +02:00
|
|
|
#define GOSSIP_STORE_VERSION 3
|
2018-08-30 02:04:28 +02:00
|
|
|
|
2018-03-13 12:08:03 +01:00
|
|
|
struct gossip_store;
|
2018-03-23 17:34:11 +01:00
|
|
|
struct routing_state;
|
2018-03-13 12:08:03 +01:00
|
|
|
|
2018-05-30 14:27:32 +02:00
|
|
|
struct gossip_store *gossip_store_new(const tal_t *ctx,
|
2018-05-30 19:24:56 +02:00
|
|
|
struct routing_state *rstate,
|
2018-05-30 14:27:32 +02:00
|
|
|
struct broadcast_state *broadcast);
|
2018-03-13 12:08:03 +01:00
|
|
|
|
|
|
|
/**
|
2018-04-11 01:03:35 +02:00
|
|
|
* Load the initial gossip store, if any.
|
2018-03-13 12:08:03 +01:00
|
|
|
*
|
2018-04-11 01:03:35 +02:00
|
|
|
* @param rstate The routing state to load init.
|
2018-03-13 12:08:03 +01:00
|
|
|
* @param gs The `gossip_store` to read from
|
|
|
|
*/
|
2018-04-11 01:03:35 +02:00
|
|
|
void gossip_store_load(struct routing_state *rstate, struct gossip_store *gs);
|
2018-03-13 12:08:03 +01:00
|
|
|
|
2018-03-23 17:34:11 +01:00
|
|
|
/**
|
2018-05-30 20:29:17 +02:00
|
|
|
* Add a gossip message to the gossip_store
|
2018-03-23 17:34:11 +01:00
|
|
|
*/
|
2018-05-30 20:29:17 +02:00
|
|
|
void gossip_store_add(struct gossip_store *gs, const u8 *gossip_msg);
|
2018-03-25 18:23:10 +02:00
|
|
|
|
2018-03-28 12:54:09 +02:00
|
|
|
/**
|
|
|
|
* Remember that we deleted a channel as a result of its outpoint being spent
|
|
|
|
*/
|
|
|
|
void gossip_store_add_channel_delete(struct gossip_store *gs,
|
|
|
|
const struct short_channel_id *scid);
|
|
|
|
|
2019-04-08 01:52:19 +02:00
|
|
|
/* Expose for dev-compact-gossip-store */
|
|
|
|
bool gossip_store_compact(struct gossip_store *gs);
|
2018-03-26 02:05:34 +02:00
|
|
|
#endif /* LIGHTNING_GOSSIPD_GOSSIP_STORE_H */
|