Skip to content

Commit

Permalink
node: change rolling_finality method to log when finality is triggered
Browse files Browse the repository at this point in the history
  • Loading branch information
herr-seppia committed Jun 19, 2024
1 parent 3cbea73 commit 334ad73
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions node/src/chain/acceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network> Acceptor<N, DB, VM> {
.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();
Expand Down Expand Up @@ -561,7 +561,6 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network> Acceptor<N, DB, VM> {
generator = tip.inner().header().generator_bls_pubkey.to_bs58(),
dur_ms = duration.as_millis(),
label = format!("{:?}", label),
ffr
);

// Restart Consensus.
Expand All @@ -584,9 +583,7 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network> Acceptor<N, DB, VM> {
attested: bool,
tip_is_final: bool,
blk: &Block,
) -> Result<(Label, bool), anyhow::Error> {
// Final from rolling
let mut ffr = false;
) -> Result<Label, anyhow::Error> {
let label = match (attested, tip_is_final) {
(true, true) => Label::Final,
(false, _) => Label::Accepted,
Expand All @@ -609,12 +606,17 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network> Acceptor<N, DB, VM> {
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.
Expand Down

0 comments on commit 334ad73

Please sign in to comment.