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

perf(engine): avoid unnecessary arc clones on new head #11381

Merged
merged 1 commit into from
Oct 1, 2024
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
6 changes: 3 additions & 3 deletions crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,9 +865,9 @@ where
// that are _above_ the current canonical head.
while current_number > current_canonical_number {
if let Some(block) = self.executed_block_by_hash(current_hash)? {
new_chain.push(block.clone());
current_hash = block.block.parent_hash;
current_number -= 1;
new_chain.push(block);
} else {
warn!(target: "engine::tree", current_hash=?current_hash, "Sidechain block not found in TreeState");
// This should never happen as we're walking back a chain that should connect to
Expand All @@ -891,8 +891,8 @@ where

while old_hash != current_hash {
if let Some(block) = self.executed_block_by_hash(old_hash)? {
old_chain.push(block.clone());
old_hash = block.block.header.parent_hash;
old_chain.push(block);
} else {
// This shouldn't happen as we're walking back the canonical chain
warn!(target: "engine::tree", current_hash=?old_hash, "Canonical block not found in TreeState");
Expand All @@ -906,8 +906,8 @@ where

if let Some(block) = self.executed_block_by_hash(current_hash)? {
if self.is_fork(block.block.hash(), finalized_block)? {
new_chain.push(block.clone());
current_hash = block.block.parent_hash;
new_chain.push(block);
}
} else {
// This shouldn't happen as we've already walked this path
Expand Down
Loading