mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-07 16:14:26 +01:00
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:
committed by
neil saitug
parent
aafc489edb
commit
2fd4a0121f
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user