Browse Source

gossipd: restore dev-suppress-gossip functionality.

Don't start new peers, and don't check on existing peers.  This should
get rid of most gossip.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
committed by neil saitug
parent
commit
d2a5f056a8
  1. 7
      gossipd/gossipd.c
  2. 19
      gossipd/seeker.c
  3. 4
      gossipd/seeker.h

7
gossipd/gossipd.c

@ -67,11 +67,6 @@
#include <wire/wire_io.h>
#include <wire/wire_sync.h>
/* 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);
}

19
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)

4
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 */

Loading…
Cancel
Save