chore(tree): use with_capacity at collect_blocks_for_canonical_unwind() (#20682)

This commit is contained in:
fig
2025-12-30 12:32:02 +00:00
committed by GitHub
parent 0808bd67c2
commit 454b060d5a

View File

@@ -825,7 +825,8 @@ where
new_head_number: u64,
current_head_number: u64,
) -> Vec<ExecutedBlock<N>> {
let mut old_blocks = Vec::new();
let mut old_blocks =
Vec::with_capacity((current_head_number.saturating_sub(new_head_number)) as usize);
for block_num in (new_head_number + 1)..=current_head_number {
if let Some(block_state) = self.canonical_in_memory_state.state_by_number(block_num) {