mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 09:04:22 +01:00
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>
This commit is contained in:
committed by
neil saitug
parent
7d207c50fa
commit
d2a5f056a8
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user