gossipd: unify is_chan_public / is_chan_announced.

We used to have a `struct chan` while we're waiting for an update; now we
keep that internally.  So a `struct chan` without a channel_announcement
in the store is private, and other is public.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-04-11 14:45:22 +09:30
committed by neil saitug
parent aafc489edb
commit 2fd4a0121f
3 changed files with 4 additions and 10 deletions

View File

@@ -1109,7 +1109,7 @@ static void maybe_create_next_scid_reply(struct peer *peer)
struct chan *chan;
chan = get_channel(rstate, &peer->scid_queries[i]);
if (!chan || !is_chan_announced(chan))
if (!chan || !is_chan_public(chan))
continue;
queue_peer_msg(peer, chan->channel_announce);

View File

@@ -307,7 +307,7 @@ static bool node_announce_predates_channels(const struct node *node)
struct chan *c;
for (c = first_chan(node, &i); c; c = next_chan(node, &i)) {
if (!is_chan_announced(c))
if (!is_chan_public(c))
continue;
if (c->bcast.index < node->bcast.index)

View File

@@ -64,15 +64,9 @@ struct chan {
struct amount_sat sat;
};
/* A local channel can exist which isn't announcable. */
/* A local channel can exist which isn't announced; normal channels are only
* created once we have both an announcement *and* an update. */
static inline bool is_chan_public(const struct chan *chan)
{
return chan->channel_announce != NULL;
}
/* A channel is only announced once we have a channel_update to send
* with it. */
static inline bool is_chan_announced(const struct chan *chan)
{
return chan->bcast.index != 0;
}