From 1e4959af1f2d8a78ce08b2e558f0c804b52bb93f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 2 Mar 2018 19:29:17 +1030 Subject: [PATCH] gossipd: fix case where we get an update on a pruned channel. We discarded it; we should populate it. The comment is wrong, since local_add_channel() doesn't add public channels, and we test that above. Signed-off-by: Rusty Russell --- gossipd/routing.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/gossipd/routing.c b/gossipd/routing.c index b3eaaf265..be791d297 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -892,21 +892,19 @@ void handle_channel_update(struct routing_state *rstate, const u8 *update) c = chan->connections[direction]; - /* When we local_add_channel(), we only half-populate, so this case - * is possible. */ + /* Channel could have been pruned: re-add */ if (!c) { - SUPERVERBOSE("Ignoring update for unknown half channel %s", - type_to_string(trc, struct short_channel_id, - &short_channel_id)); + c = new_node_connection(rstate, chan, + chan->nodes[direction], + chan->nodes[!direction], + direction); + } else if (c->last_timestamp >= timestamp) { + SUPERVERBOSE("Ignoring outdated update."); tal_free(tmpctx); return; } - if (c->last_timestamp >= timestamp) { - SUPERVERBOSE("Ignoring outdated update."); - tal_free(tmpctx); - return; - } else if (!check_channel_update(&c->src->id, &signature, serialized)) { + if (!check_channel_update(&c->src->id, &signature, serialized)) { status_trace("Signature verification failed."); tal_free(tmpctx); return;