Browse Source

gossipd: fix reordering of node_announcements in presence of a unannounced channel.

If we receive a channel_announce but not a channel_update, we store the announce
but don't put it in the broadcast map.

When we delete a channel, we check if the node_announcement broadcast
now preceeds all channel_announcements, and if so, we move it to the
end of the map.  However, with a channel_announcement at index '0',
this test fails.

This is at least one potential cause of the node map getting out of order.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 6 years ago
committed by Christian Decker
parent
commit
97c7ba2f80
  1. 2
      gossipd/routing.c
  2. 8
      gossipd/routing.h

2
gossipd/routing.c

@ -199,7 +199,7 @@ static bool remove_channel_from_array(struct chan ***chans, const struct chan *c
static bool node_announce_predates_channels(const struct node *node)
{
for (size_t i = 0; i < tal_count(node->chans); i++) {
if (!is_chan_public(node->chans[i]))
if (!is_chan_announced(node->chans[i]))
continue;
if (node->chans[i]->channel_announcement_index

8
gossipd/routing.h

@ -61,11 +61,19 @@ struct chan {
u64 satoshis;
};
/* A local channel can exist which isn't announcable. */
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->channel_announcement_index != 0;
}
static inline bool is_halfchan_defined(const struct half_chan *hc)
{
return hc->channel_update != NULL;

Loading…
Cancel
Save