gossipd: load and store node_announcements correctly
Loading the gossip_store would not create a pending node announcement when the node already had a zombie channel. This would cause the node announcement to attempt to be loaded, but fail because it had no broadcastable channels. Accepting a pending node announcement as when normally loading from the channel corrects this. `node_has_public_channels` taking into account zombie channels enables this behavior. Separately, node_announcements were still being flagged as zombies in the gossip store despite that feature being removed. Changelog-None
This commit is contained in:
parent
d5246e43bb
commit
d1402e06f9
|
@ -884,7 +884,7 @@ u32 gossip_store_load(struct routing_state *rstate, struct gossip_store *gs)
|
|||
case WIRE_NODE_ANNOUNCEMENT:
|
||||
/* In early v23.02 rcs we had zombie node announcements,
|
||||
* so throw them away here. */
|
||||
if (be16_to_cpu(hdr.flags) & GOSSIP_STORE_ZOMBIE_BIT) {
|
||||
if (zombie) {
|
||||
status_unusual("gossip_store: removing zombie"
|
||||
" node_announcement from v23.02 rcs");
|
||||
break;
|
||||
|
|
|
@ -381,6 +381,13 @@ static struct node *new_node(struct routing_state *rstate,
|
|||
return n;
|
||||
}
|
||||
|
||||
static bool is_chan_zombie(struct chan *chan)
|
||||
{
|
||||
if (chan->half[0].zombie || chan->half[1].zombie)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* We've received a channel_announce for a channel attached to this node:
|
||||
* otherwise it's in the map only because it's a peer, or us. */
|
||||
static bool node_has_public_channels(struct node *node)
|
||||
|
@ -389,19 +396,12 @@ static bool node_has_public_channels(struct node *node)
|
|||
struct chan *c;
|
||||
|
||||
for (c = first_chan(node, &i); c; c = next_chan(node, &i)) {
|
||||
if (is_chan_public(c))
|
||||
if (is_chan_public(c) && !is_chan_zombie(c))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool is_chan_zombie(struct chan *chan)
|
||||
{
|
||||
if (chan->half[0].zombie || chan->half[1].zombie)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool is_node_zombie(struct node* node)
|
||||
{
|
||||
struct chan_map_iter i;
|
||||
|
@ -1907,7 +1907,7 @@ bool routing_add_node_announcement(struct routing_state *rstate,
|
|||
= gossip_store_add(rstate->gs, msg, timestamp,
|
||||
node_id_eq(&node_id,
|
||||
&rstate->local_id),
|
||||
is_node_zombie(node), spam, NULL);
|
||||
false, spam, NULL);
|
||||
if (node->bcast.timestamp > rstate->last_timestamp
|
||||
&& node->bcast.timestamp < time_now().ts.tv_sec)
|
||||
rstate->last_timestamp = node->bcast.timestamp;
|
||||
|
|
Loading…
Reference in New Issue