From f4d622a34c4f0869c911e5f52192823647100250 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 2 Nov 2022 22:39:39 -0400 Subject: [PATCH] Restore cache --- substrate/tendermint/client/src/tendermint.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/substrate/tendermint/client/src/tendermint.rs b/substrate/tendermint/client/src/tendermint.rs index 042a6902..c6b0140d 100644 --- a/substrate/tendermint/client/src/tendermint.rs +++ b/substrate/tendermint/client/src/tendermint.rs @@ -176,6 +176,16 @@ impl TendermintImport { &self, block: &mut BlockImportParams, ) -> Result<(), Error> { + if block.finalized { + if block.fork_choice != Some(ForkChoiceStrategy::Custom(false)) { + // Since we alw1ays set the fork choice, this means something else marked the block as + // finalized, which shouldn't be possible. Ensuring nothing else is setting blocks as + // finalized helps ensure our security + panic!("block was finalized despite not setting the fork choice"); + } + return Ok(()); + } + // Set the block as a worse choice block.fork_choice = Some(ForkChoiceStrategy::Custom(false));