forked from satindergrewal/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gossip_store.h
56 lines (46 loc) · 1.5 KB
/
gossip_store.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef GOSSIPD_GOSSIP_STORE_H
#define GOSSIPD_GOSSIP_STORE_H
#include "config.h"
#include <ccan/short_types/short_types.h>
#include <ccan/tal/tal.h>
#include <gossipd/routing.h>
/**
* gossip_store -- On-disk storage related information
*/
struct gossip_store;
struct routing_state;
struct gossip_store *gossip_store_new(const tal_t *ctx);
/**
* Write an incoming message to the `gossip_store`
*
* @param gs The gossip_store to write to
* @param msg The message to write
* @return The newly created and initialized `gossip_store`
*/
void gossip_store_append(struct gossip_store *gs, const u8 *msg);
/**
* Retrieve the next gossip message if any
*
* @param ctx The context to allocate the message from
* @param gs The `gossip_store` to read from
* @return whether a message was read from the store. False means that all
* messages have been processed.
*/
bool gossip_store_read_next(struct routing_state *rstate,
struct gossip_store *gs);
/**
* 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);
/**
* 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);
/**
* 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);
#endif /* GOSSIPD_GOSSIP_STORE_H */