From 5a8677edc6e71fc4d105d8ee8ac4f6cdd550ae00 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 6 Nov 2019 12:46:09 +1030 Subject: [PATCH] gossipd: add txout_failure when a close is seen. This prevents a gratuitous lookup of we get a late channel_announce, but even better, it suppresses the "bad gossip" messages in case of a late channel_update, which have plagued Travis (especially since we got aggressive in pushing our own updates). Signed-off-by: Rusty Russell --- gossipd/gossipd.c | 2 ++ gossipd/routing.c | 4 ++-- gossipd/routing.h | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index c0040de7d..ed936807f 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -1517,6 +1517,8 @@ static struct io_plan *handle_outpoint_spent(struct io_conn *conn, "Deleting channel %s due to the funding outpoint being " "spent", type_to_string(msg, struct short_channel_id, &scid)); + /* Suppress any now-obsolete updates/announcements */ + add_to_txout_failures(rstate, &scid); remove_channel_from_store(rstate, chan); /* Freeing is sufficient since everything else is allocated off * of the channel and this takes care of unregistering diff --git a/gossipd/routing.c b/gossipd/routing.c index 18b3cc7be..2cfeccc7b 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -258,8 +258,8 @@ static void txout_failure_age(struct routing_state *rstate) txout_failure_age, rstate); } -static void add_to_txout_failures(struct routing_state *rstate, - const struct short_channel_id *scid) +void add_to_txout_failures(struct routing_state *rstate, + const struct short_channel_id *scid) { if (uintmap_add(&rstate->txout_failures, scid->u64, true) && ++rstate->num_txout_failures == 10000) { diff --git a/gossipd/routing.h b/gossipd/routing.h index 0880108d2..cf994511e 100644 --- a/gossipd/routing.h +++ b/gossipd/routing.h @@ -529,4 +529,8 @@ void remove_channel_from_store(struct routing_state *rstate, const char *unfinalized_entries(const tal_t *ctx, struct routing_state *rstate); void remove_all_gossip(struct routing_state *rstate); + +/* This scid is dead to us. */ +void add_to_txout_failures(struct routing_state *rstate, + const struct short_channel_id *scid); #endif /* LIGHTNING_GOSSIPD_ROUTING_H */