mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-05 06:04:21 +01:00
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 <rusty@rustcorp.com.au>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user