From 334ad73ec8de9e6898f9d7c1dcdebf417fc59f1c Mon Sep 17 00:00:00 2001 From: Herr Seppia Date: Mon, 17 Jun 2024 16:33:11 +0200 Subject: [PATCH] node: change `rolling_finality` method to log when finality is triggered --- node/src/chain/acceptor.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/node/src/chain/acceptor.rs b/node/src/chain/acceptor.rs index 8cb4e7f010..83a88dbf88 100644 --- a/node/src/chain/acceptor.rs +++ b/node/src/chain/acceptor.rs @@ -423,8 +423,8 @@ impl Acceptor { .record(header_verification_start.elapsed()); - let (label, ffr) = - self.rolling_finality(attested, tip.is_final(), blk).await?; + let tip_is_final = tip.is_final(); + let label = self.rolling_finality(attested, tip_is_final, blk).await?; let blk = BlockWithLabel::new_with_label(blk.clone(), label); let header = blk.inner().header(); @@ -561,7 +561,6 @@ impl Acceptor { generator = tip.inner().header().generator_bls_pubkey.to_bs58(), dur_ms = duration.as_millis(), label = format!("{:?}", label), - ffr ); // Restart Consensus. @@ -584,9 +583,7 @@ impl Acceptor { attested: bool, tip_is_final: bool, blk: &Block, - ) -> Result<(Label, bool), anyhow::Error> { - // Final from rolling - let mut ffr = false; + ) -> Result { let label = match (attested, tip_is_final) { (true, true) => Label::Final, (false, _) => Label::Accepted, @@ -609,12 +606,17 @@ impl Acceptor { Some((_,Label::Attested)) => {} // just continue scan }; } - ffr = true; + info!( + event = "rolling finality", + height = blk.header().height, + hash = to_str(&blk.header().hash), + state_hash = to_str(&blk.header().state_hash), + ); anyhow::Ok(Label::Final) })? } }; - Ok((label, ffr)) + Ok(label) } /// Implements the algorithm of full revert to any of supported targets.