Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalize domain block only when the new finalized block is higher than last finalized #1540

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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