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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-03-02 19:29:17 +10:30 committed by Christian Decker
parent 961321a6d8
commit 1e4959af1f
1 changed files with 8 additions and 10 deletions

View File

@ -892,21 +892,19 @@ void handle_channel_update(struct routing_state *rstate, const u8 *update)
c = chan->connections[direction]; c = chan->connections[direction];
/* When we local_add_channel(), we only half-populate, so this case /* Channel could have been pruned: re-add */
* is possible. */
if (!c) { if (!c) {
SUPERVERBOSE("Ignoring update for unknown half channel %s", c = new_node_connection(rstate, chan,
type_to_string(trc, struct short_channel_id, chan->nodes[direction],
&short_channel_id)); chan->nodes[!direction],
direction);
} else if (c->last_timestamp >= timestamp) {
SUPERVERBOSE("Ignoring outdated update.");
tal_free(tmpctx); tal_free(tmpctx);
return; return;
} }
if (c->last_timestamp >= timestamp) { if (!check_channel_update(&c->src->id, &signature, serialized)) {
SUPERVERBOSE("Ignoring outdated update.");
tal_free(tmpctx);
return;
} else if (!check_channel_update(&c->src->id, &signature, serialized)) {
status_trace("Signature verification failed."); status_trace("Signature verification failed.");
tal_free(tmpctx); tal_free(tmpctx);
return; return;