From 8d98546240a97304277e21be8087bcf14eff1729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Rosales?= Date: Wed, 18 Dec 2024 22:35:02 -0600 Subject: [PATCH] fix(cat-gateway): cleanup --- catalyst-gateway/bin/src/cardano/mod.rs | 14 +------------- .../bin/src/db/index/block/roll_forward.rs | 1 - 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/catalyst-gateway/bin/src/cardano/mod.rs b/catalyst-gateway/bin/src/cardano/mod.rs index 0f8e5e6384a..41aadf69695 100644 --- a/catalyst-gateway/bin/src/cardano/mod.rs +++ b/catalyst-gateway/bin/src/cardano/mod.rs @@ -449,19 +449,7 @@ impl SyncTask { }, } - // TODO: IF there is only 1 chain follower left in sync_tasks, then all - // immutable followers have finished. - // When this happens we need to purge the live index of any records that - // exist before the current immutable tip. - // Note: to prevent a data race when multiple nodes are syncing, we - // probably want to put a gap in this, so that there are X - // slots of overlap between the live chain and immutable - // chain. This gap should be a parameter. - - // WIP: How do we check that only one follower is left, and that the slot buffer - // (overlap) criteria is met? - let only_one_chain_follower_left = false; - if only_one_chain_follower_left { + if self.sync_tasks.len() == 1 { if let Err(error) = roll_forward::purge_live_index(self.immutable_tip_slot).await { error!(chain=%self.cfg.chain, error=%error, "BUG: Purging volatile data task failed."); } diff --git a/catalyst-gateway/bin/src/db/index/block/roll_forward.rs b/catalyst-gateway/bin/src/db/index/block/roll_forward.rs index 9a649a73f66..4cd98b16aec 100644 --- a/catalyst-gateway/bin/src/db/index/block/roll_forward.rs +++ b/catalyst-gateway/bin/src/db/index/block/roll_forward.rs @@ -10,7 +10,6 @@ use crate::{ }; /// Purge Data from Live Index -#[allow(unused_variables)] pub(crate) async fn purge_live_index(purge_slot: u64) -> anyhow::Result<()> { let persistent = false; // get volatile session let Some(session) = CassandraSession::get(persistent) else {