diff --git a/src/chain_sync/chain_follower.rs b/src/chain_sync/chain_follower.rs index 8848d4933706..152b4fe97523 100644 --- a/src/chain_sync/chain_follower.rs +++ b/src/chain_sync/chain_follower.rs @@ -19,7 +19,7 @@ use super::network_context::SyncNetworkContext; use crate::{ blocks::{Block, FullTipset, Tipset, TipsetKey}, - chain::ChainStore, + chain::{ChainStore, index::ResolveNullTipset}, chain_sync::{ ForkSyncInfo, ForkSyncStage, SyncStatus, SyncStatusReport, TipsetValidator, bad_block_cache::{BadBlockCache, SeenBlockCache}, @@ -698,6 +698,16 @@ impl SyncStateMachine { return; } + // Skip if tipset is part of the current chain. + if let Ok(Some(ts)) = self.cs.chain_index().tipset_by_height( + tipset.epoch(), + self.cs.heaviest_tipset(), + ResolveNullTipset::TakeOlder, + ) && ts.key() == tipset.key() + { + return; + } + // Find any existing tipsets with same epoch and parents let mut to_remove = Vec::new(); #[allow(clippy::mutable_key_type)]