Skip to content

Commit

Permalink
Finalize domain block only when the new finalized block is higher tha…
Browse files Browse the repository at this point in the history
…n last finalized

Ref paritytech/substrate#14347
  • Loading branch information
liuchengxu committed Jun 14, 2023
1 parent 530b424 commit ba266e9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions domains/client/domain-executor/src/domain_block_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,17 @@ where
if let Some(to_finalize_block_number) =
header_number.checked_sub(&self.domain_confirmation_depth)
{
let to_finalize_block_hash =
self.client.hash(to_finalize_block_number)?.ok_or_else(|| {
sp_blockchain::Error::Backend(format!(
"Header for #{to_finalize_block_number} not found"
))
})?;
self.client
.finalize_block(to_finalize_block_hash, None, true)?;
tracing::debug!(
"Successfully finalized block: #{to_finalize_block_number},{to_finalize_block_hash}"
);
if to_finalize_block_number > self.client.info().finalized_number {
let to_finalize_block_hash =
self.client.hash(to_finalize_block_number)?.ok_or_else(|| {
sp_blockchain::Error::Backend(format!(
"Header for #{to_finalize_block_number} not found"
))
})?;
self.client
.finalize_block(to_finalize_block_hash, None, true)?;
tracing::debug!("Successfully finalized block: #{to_finalize_block_number},{to_finalize_block_hash}");
}
}

let mut roots = self.client.runtime_api().intermediate_roots(header_hash)?;
Expand Down

0 comments on commit ba266e9

Please sign in to comment.