mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-04 13:44:22 +01:00
gossip: Pass routing_state to the gossip_store
We'll need it later to annotate the raw gossip messages, e.g., the capacity of a channel. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
@@ -28,6 +28,9 @@ struct gossip_store {
|
||||
* gossip_store */
|
||||
struct broadcast_state *broadcast;
|
||||
|
||||
/* Handle to the routing_state to retrieve additional information,
|
||||
* should it be needed */
|
||||
struct routing_state *rstate;
|
||||
};
|
||||
|
||||
static void gossip_store_destroy(struct gossip_store *gs)
|
||||
@@ -36,12 +39,14 @@ static void gossip_store_destroy(struct gossip_store *gs)
|
||||
}
|
||||
|
||||
struct gossip_store *gossip_store_new(const tal_t *ctx,
|
||||
struct routing_state *rstate,
|
||||
struct broadcast_state *broadcast)
|
||||
{
|
||||
struct gossip_store *gs = tal(ctx, struct gossip_store);
|
||||
gs->count = 0;
|
||||
gs->fd = open(GOSSIP_STORE_FILENAME, O_RDWR|O_APPEND|O_CREAT, 0600);
|
||||
gs->broadcast = broadcast;
|
||||
gs->rstate = rstate;
|
||||
|
||||
tal_add_destructor(gs, gossip_store_destroy);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ struct gossip_store;
|
||||
struct routing_state;
|
||||
|
||||
struct gossip_store *gossip_store_new(const tal_t *ctx,
|
||||
struct routing_state *rstate,
|
||||
struct broadcast_state *broadcast);
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,7 +96,7 @@ struct routing_state *new_routing_state(const tal_t *ctx,
|
||||
rstate->chain_hash = *chain_hash;
|
||||
rstate->local_id = *local_id;
|
||||
rstate->prune_timeout = prune_timeout;
|
||||
rstate->store = gossip_store_new(rstate, rstate->broadcasts);
|
||||
rstate->store = gossip_store_new(rstate, rstate, rstate->broadcasts);
|
||||
rstate->dev_allow_localhost = dev_allow_localhost;
|
||||
rstate->local_channel_announced = false;
|
||||
list_head_init(&rstate->pending_cannouncement);
|
||||
|
||||
Reference in New Issue
Block a user