diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index 2b5600ffe..7e8f8020e 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -67,11 +67,6 @@ #include #include -/* In developer mode we provide hooks for whitebox testing */ -#if DEVELOPER -static bool suppress_gossip = false; -#endif - /*~ A channel consists of a `struct half_chan` for each direction, each of * which has a `flags` word from the `channel_update`; bit 1 is * ROUTING_FLAGS_DISABLED in the `channel_update`. But we also keep a local @@ -1289,7 +1284,7 @@ static struct io_plan *dev_gossip_suppress(struct io_conn *conn, master_badmsg(WIRE_GOSSIP_DEV_SUPPRESS, msg); status_unusual("Suppressing all gossip"); - suppress_gossip = true; + dev_suppress_gossip = true; return daemon_conn_read_next(conn, daemon->master); } diff --git a/gossipd/seeker.c b/gossipd/seeker.c index 9f321362b..b2c5b4e3e 100644 --- a/gossipd/seeker.c +++ b/gossipd/seeker.c @@ -39,6 +39,10 @@ enum seeker_state { ASKING_FOR_STALE_SCIDS, }; +#if DEVELOPER +bool dev_suppress_gossip; +#endif + /* Passthrough helper for HTABLE_DEFINE_TYPE */ static const struct short_channel_id *scid_pass(const struct short_channel_id *s) { @@ -242,6 +246,11 @@ static void enable_gossip_stream(struct seeker *seeker, struct peer *peer) u32 start = seeker->daemon->rstate->last_timestamp; u8 *msg; +#if DEVELOPER + if (dev_suppress_gossip) + return; +#endif + if (start > polltime) start -= polltime; else @@ -870,6 +879,11 @@ static bool seek_any_unknown_nodes(struct seeker *seeker) /* Periodic timer to see how our gossip is going. */ static void seeker_check(struct seeker *seeker) { +#if DEVELOPER + if (dev_suppress_gossip) + return; +#endif + switch (seeker->state) { case STARTING_UP: check_firstpeer(seeker); @@ -906,6 +920,11 @@ void seeker_setup_peer_gossip(struct seeker *seeker, struct peer *peer) if (!peer->gossip_queries_feature) return; +#if DEVELOPER + if (dev_suppress_gossip) + return; +#endif + switch (seeker->state) { case STARTING_UP: if (!have_probing_peer) diff --git a/gossipd/seeker.h b/gossipd/seeker.h index af2a752c5..87fa89fc9 100644 --- a/gossipd/seeker.h +++ b/gossipd/seeker.h @@ -22,4 +22,8 @@ bool remove_unknown_scid(struct seeker *seeker, bool add_unknown_scid(struct seeker *seeker, const struct short_channel_id *scid, struct peer *peer); + +/* A testing hack */ +extern bool dev_suppress_gossip; + #endif /* LIGHTNING_GOSSIPD_SEEKER_H */