From 531793b4be6d6c55f7c6a13f6da1982a7387f185 Mon Sep 17 00:00:00 2001 From: DimAn Date: Wed, 21 Feb 2024 22:23:23 +0400 Subject: [PATCH] validator: ignore too old tower error (#35229) * validator: ignore too old tower error * Update core/src/replay_stage.rs Co-authored-by: Ashwin Sekar * remove redundant references --------- Co-authored-by: Ashwin Sekar --- core/src/consensus.rs | 3 +++ core/src/replay_stage.rs | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/core/src/consensus.rs b/core/src/consensus.rs index 3e24f33233863e..ab316d7c7da612 100644 --- a/core/src/consensus.rs +++ b/core/src/consensus.rs @@ -1533,6 +1533,9 @@ impl TowerError { false } } + pub fn is_too_old(&self) -> bool { + matches!(self, TowerError::TooOldTower(_, _)) + } } #[derive(Debug)] diff --git a/core/src/replay_stage.rs b/core/src/replay_stage.rs index 31595e6b6504d9..485c58bdd57fa5 100644 --- a/core/src/replay_stage.rs +++ b/core/src/replay_stage.rs @@ -1171,6 +1171,13 @@ impl ReplayStage { node_pubkey, vote_account, ) + } else if err.is_too_old() { + warn!("Failed to load tower, too old for {}: {}. Creating a new tower from bankforks.", node_pubkey, err); + Tower::new_from_bankforks( + &bank_forks.read().unwrap(), + node_pubkey, + vote_account, + ) } else { error!("Failed to load tower for {}: {}", node_pubkey, err); std::process::exit(1);