Skip to content

Commit

Permalink
Merge pull request #1540 from subspace/finalize-domain-block-only-whe…
Browse files Browse the repository at this point in the history
…n-new-finalized-is-higher

Finalize domain block only when the new finalized block is higher than last finalized
  • Loading branch information
liuchengxu authored Jun 13, 2023
2 parents 38decf2 + 12c7062 commit 328e79b
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 @@ -236,17 +236,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 328e79b

Please sign in to comment.