From 5c14f24bb36e67d37f78c95777d3613b372b2770 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sun, 18 Mar 2018 15:01:22 +0100 Subject: [PATCH] gossip: Add gossip_store to the routing_state Signed-off-by: Christian Decker --- gossipd/routing.c | 1 + gossipd/routing.h | 5 +++++ gossipd/test/run-bench-find_route.c | 1 + gossipd/test/run-find_route-specific.c | 1 + gossipd/test/run-find_route.c | 1 + 5 files changed, 9 insertions(+) diff --git a/gossipd/routing.c b/gossipd/routing.c index 0d84c3e32..c8e28d95e 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -93,6 +93,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); list_head_init(&rstate->pending_cannouncement); uintmap_init(&rstate->chanmap); diff --git a/gossipd/routing.h b/gossipd/routing.h index c2db20b91..294bc6be2 100644 --- a/gossipd/routing.h +++ b/gossipd/routing.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -157,6 +158,10 @@ struct routing_state { /* How old does a channel have to be before we prune it? */ u32 prune_timeout; + /* Store for processed messages that we might want to remember across + * restarts */ + struct gossip_store *store; + /* A map of channels indexed by short_channel_ids */ UINTMAP(struct chan *) chanmap; }; diff --git a/gossipd/test/run-bench-find_route.c b/gossipd/test/run-bench-find_route.c index 5bd8b5783..f4c5ad03f 100644 --- a/gossipd/test/run-bench-find_route.c +++ b/gossipd/test/run-bench-find_route.c @@ -47,6 +47,7 @@ static int fake_pubkey_cmp(const struct pubkey *a, const struct pubkey *b) #define pubkey_cmp fake_pubkey_cmp #define type_to_string_ fake_type_to_string_ #include "../routing.c" +#include "../gossip_store.c" #undef type_to_string_ struct broadcast_state *new_broadcast_state(tal_t *ctx UNNEEDED) diff --git a/gossipd/test/run-find_route-specific.c b/gossipd/test/run-find_route-specific.c index 61b72b2cb..9a185cd46 100644 --- a/gossipd/test/run-find_route-specific.c +++ b/gossipd/test/run-find_route-specific.c @@ -12,6 +12,7 @@ do { printf((fmt) ,##__VA_ARGS__); printf("\n"); } while(0) #include "../routing.c" +#include "../gossip_store.c" struct broadcast_state *new_broadcast_state(tal_t *ctx UNNEEDED) { diff --git a/gossipd/test/run-find_route.c b/gossipd/test/run-find_route.c index 8c3c763aa..7b3c54bbf 100644 --- a/gossipd/test/run-find_route.c +++ b/gossipd/test/run-find_route.c @@ -1,4 +1,5 @@ #include "../routing.c" +#include "../gossip_store.c" #include struct broadcast_state *new_broadcast_state(tal_t *ctx UNNEEDED)