dev: --dev-gossip-time so gossipd doesn't prune old data.

This is useful for canned data, such as the million channels project.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-04-08 09:21:30 +09:30
parent b2c93beaed
commit f8f6533dba
11 changed files with 64 additions and 13 deletions

View File

@@ -214,6 +214,11 @@ struct routing_state {
/* Cache for txout queries that failed. Allows us to skip failed
* checks if we get another announcement for the same scid. */
UINTMAP(bool) txout_failures;
#if DEVELOPER
/* Override local time for gossip messages */
struct timeabs *gossip_time;
#endif
};
static inline struct chan *
@@ -234,7 +239,8 @@ struct route_hop {
struct routing_state *new_routing_state(const tal_t *ctx,
const struct chainparams *chainparams,
const struct pubkey *local_id,
u32 prune_timeout);
u32 prune_timeout,
const u32 *dev_gossip_time);
/**
* Add a new bidirectional channel from id1 to id2 with the given
@@ -345,4 +351,12 @@ bool handle_local_add_channel(struct routing_state *rstate, const u8 *msg);
void memleak_remove_routing_tables(struct htable *memtable,
const struct routing_state *rstate);
#endif
/**
* Get the local time.
*
* This gets overridden in dev mode so we can use canned (stale) gossip.
*/
struct timeabs gossip_time_now(const struct routing_state *rstate);
#endif /* LIGHTNING_GOSSIPD_ROUTING_H */