gossip: HalfChans are public if we have an update and the Chan is

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2018-05-04 00:13:12 +02:00
committed by Rusty Russell
parent b028a363d8
commit 9cfd09dc4a
2 changed files with 6 additions and 4 deletions

View File

@@ -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) {

View File

@@ -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;
}