Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert zombie markers (minimal) #6069

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions gossipd/gossip_store.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,6 @@ u32 gossip_store_load(struct routing_state *rstate, struct gossip_store *gs)
gs->writable = false;
while (pread(gs->fd, &hdr, sizeof(hdr), gs->len) == sizeof(hdr)) {
bool spam;
bool zombie;

msglen = be16_to_cpu(hdr.len);
checksum = be32_to_cpu(hdr.crc);
Expand All @@ -803,7 +802,6 @@ u32 gossip_store_load(struct routing_state *rstate, struct gossip_store *gs)
goto next;
}
spam = (be16_to_cpu(hdr.flags) & GOSSIP_STORE_RATELIMIT_BIT);
zombie = (be16_to_cpu(hdr.flags) & GOSSIP_STORE_ZOMBIE_BIT);

switch (fromwire_peektype(msg)) {
case WIRE_GOSSIP_STORE_PRIVATE_CHANNEL: {
Expand Down Expand Up @@ -875,20 +873,13 @@ u32 gossip_store_load(struct routing_state *rstate, struct gossip_store *gs)
if (!routing_add_channel_update(rstate,
take(msg), gs->len,
NULL, false,
spam, zombie)) {
spam, false)) {
bad = "Bad channel_update";
goto badmsg;
}
stats[1]++;
break;
case WIRE_NODE_ANNOUNCEMENT:
/* In early v23.02 rcs we had zombie node announcements,
* so throw them away here. */
if (zombie) {
status_unusual("gossip_store: removing zombie"
" node_announcement from v23.02 rcs");
break;
}
if (!routing_add_node_announcement(rstate,
take(msg), gs->len,
NULL, NULL, spam)) {
Expand Down
54 changes: 3 additions & 51 deletions gossipd/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -2018,52 +2018,6 @@ u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann,
return NULL;
}

/* Set zombie flags in gossip_store and tombstone the channel for any
* gossip_store consumers. Remove any orphaned node_announcements. */
static void zombify_channel(struct routing_state *rstate, struct chan *channel)
{
struct half_chan *half;
assert(!is_chan_zombie(channel));
gossip_store_mark_channel_zombie(rstate->gs, &channel->bcast);
gossip_store_mark_channel_deleted(rstate->gs, &channel->scid);
for (int i = 0; i < 2; i++) {
half = &channel->half[i];
half->zombie = true;
if (half->bcast.index) {
gossip_store_mark_cupdate_zombie(rstate->gs, &half->bcast);
/* Channel may also have a spam entry */
if (half->bcast.index != half->rgraph.index)
gossip_store_mark_cupdate_zombie(rstate->gs,
&half->rgraph);
}
}
status_debug("Channel %s zombified",
type_to_string(tmpctx, struct short_channel_id,
&channel->scid));

/* If one of the nodes has no remaining active channels, forget
* the node_announcement. Also recheck node_announcement order. */
for (int i = 0; i < 2; i++) {
struct node *node = channel->nodes[i];
if (node_has_broadcastable_channels(node)) {
if (!node->bcast.index)
continue;
if (node_announce_predates_channels(node)) {
/* Make sure the node announcement follows a channel
* announcement. */
force_node_announce_rexmit(rstate, node);
}
continue;
}
if (node->rgraph.index != node->bcast.index)
gossip_store_delete(rstate->gs, &node->rgraph,
WIRE_NODE_ANNOUNCEMENT);
gossip_store_delete(rstate->gs, &node->bcast,
WIRE_NODE_ANNOUNCEMENT);
node->rgraph.index = node->bcast.index = 0;
}
}

void route_prune(struct routing_state *rstate)
{
u64 now = gossip_time_now(rstate).ts.tv_sec;
Expand Down Expand Up @@ -2117,12 +2071,10 @@ void route_prune(struct routing_state *rstate)
}
}

/* Any channels missing an update are now considered zombies. They may
* come back later, in which case the channel_announcement needs to be
* stashed away for later use. If all remaining channels for a node are
* zombies, the node is zombified too. */
/* Now free all the chans and maybe even nodes. */
for (size_t i = 0; i < tal_count(pruned); i++) {
zombify_channel(rstate, pruned[i]);
remove_channel_from_store(rstate, pruned[i]);
free_chan(rstate, pruned[i]);
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2229,6 +2229,7 @@ def test_gossip_private_updates(node_factory, bitcoind):
wait_for(lambda: l1.daemon.is_in_log(r'gossip_store_compact_offline: 5 deleted, 3 copied'))


@pytest.mark.skip("Zombie research had unexpected side effects")
@pytest.mark.developer("Needs --dev-fast-gossip, --dev-fast-gossip-prune")
def test_channel_resurrection(node_factory, bitcoind):
"""When a node goes offline long enough to prune a channel, the
Expand Down