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
|
|
|
|
*/
|
|
|
|
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,
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Store a channel_announcement with all its extra data
|
|
|
|
*/
|
|
|
|
void gossip_store_add_channel_announcement(struct gossip_store *gs,
|
|
|
|
const u8 *gossip_msg, u64 satoshis);
|
2018-03-25 18:10:00 +02:00
|
|
|
|
2018-04-21 12:17:14 +02:00
|
|
|
/**
|
|
|
|
* Store a local_add_channel so we remember it when restarting
|
|
|
|
*/
|
|
|
|
void gossip_store_local_add_channel(struct gossip_store *gs,
|
|
|
|
const u8 *add_msg);
|
|
|
|
|
2018-03-25 18:10:00 +02:00
|
|
|
/**
|
|
|
|
* Store a channel_update with its associated data in the gossip_store
|
|
|
|
*/
|
|
|
|
void gossip_store_add_channel_update(struct gossip_store *gs,
|
|
|
|
const u8 *gossip_msg);
|
|
|
|
|
2018-03-25 18:23:10 +02:00
|
|
|
/**
|
|
|
|
* Store a node_announcement with its associated data in the gossip_store
|
|
|
|
*/
|
|
|
|
void gossip_store_add_node_announcement(struct gossip_store *gs,
|
|
|
|
const u8 *gossip_msg);
|
|
|
|
|
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);
|
|
|
|
|
2018-03-26 02:05:34 +02:00
|
|
|
#endif /* LIGHTNING_GOSSIPD_GOSSIP_STORE_H */
|