Browse Source

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>
pr-2587
Rusty Russell 6 years ago
committed by neil saitug
parent
commit
2fd4a0121f
  1. 2
      gossipd/gossipd.c
  2. 2
      gossipd/routing.c
  3. 10
      gossipd/routing.h

2
gossipd/gossipd.c

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

2
gossipd/routing.c

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

10
gossipd/routing.h

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

Loading…
Cancel
Save