From bfcaa3426c07566d619ca2420935c004c5160019 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 6 Mar 2023 16:40:47 +1030 Subject: [PATCH 1/3] pytest: remove zombie test. Signed-off-by: Rusty Russell --- tests/test_gossip.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_gossip.py b/tests/test_gossip.py index cd093e55dde1..1c640ed3d2be 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -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 From df5b1cc5f47fc997701ed8810e6c419d9425f78a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 6 Mar 2023 16:40:50 +1030 Subject: [PATCH 2/3] gossipd: ignore zombie flag when loading gossip_store. Signed-off-by: Rusty Russell --- gossipd/gossip_store.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/gossipd/gossip_store.c b/gossipd/gossip_store.c index 6db129f58595..8c9dcccb61bd 100644 --- a/gossipd/gossip_store.c +++ b/gossipd/gossip_store.c @@ -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); @@ -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: { @@ -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)) { From 36e8ff27b485fabd27ef34d2638d867bbce374d5 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 6 Mar 2023 16:40:50 +1030 Subject: [PATCH 3/3] gossipd: don't make new zombies, just prune channels as we did before. This reverts us to the v22.11 behaviour, pending a revisit for the next release. Changelog-Changed: gossipd: revert zombification change, keep all gossip for now. Signed-off-by: Rusty Russell --- gossipd/routing.c | 54 +++-------------------------------------------- 1 file changed, 3 insertions(+), 51 deletions(-) diff --git a/gossipd/routing.c b/gossipd/routing.c index 3c7306d48b74..1e8bd3a433f5 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -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; @@ -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]); } }