From 9cfd09dc4a05987f2c9f72f7efd1148cc16a3a59 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 4 May 2018 00:13:12 +0200 Subject: [PATCH] gossip: HalfChans are public if we have an update and the Chan is Signed-off-by: Christian Decker --- gossipd/gossip.c | 2 +- gossipd/routing.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gossipd/gossip.c b/gossipd/gossip.c index dc19e46c6..d5e9e41b1 100644 --- a/gossipd/gossip.c +++ b/gossipd/gossip.c @@ -1241,7 +1241,7 @@ static void append_half_channel(struct gossip_getchannels_entry **entries, e->satoshis = chan->satoshis; e->active = c->active; e->flags = c->flags; - e->public = (c->channel_update_msgidx != 0); + e->public = chan->public && (c->channel_update_msgidx != 0); e->short_channel_id = chan->scid; e->last_update_timestamp = c->channel_update_msgidx ? c->last_timestamp : -1; if (e->last_update_timestamp >= 0) { diff --git a/gossipd/routing.c b/gossipd/routing.c index d0d6032fc..d7930588e 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -1047,9 +1047,11 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update) if (!routing_add_channel_update(rstate, serialized)) status_failed(STATUS_FAIL_INTERNAL_ERROR, "Failed adding channel_update"); - /* Only store updates for public channels */ - if (chan->public) - gossip_store_add_channel_update(rstate->store, serialized); + + /* Store the channel_update for both public and non-public channels + * (non-public ones may just be the incoming direction). We'd have + * dropped invalid ones earlier. */ + gossip_store_add_channel_update(rstate->store, serialized); return NULL; }