perf(blockchain-tree:) use Vec::reserve_exact (#11839)

This commit is contained in:
nk_ysg
2024-10-18 00:40:59 +08:00
committed by GitHub
parent 1aa3ce1a5a
commit 0a1473b6e7

View File

@@ -902,6 +902,7 @@ where
// check unconnected block buffer for children of the chains
let mut all_chain_blocks = Vec::new();
for chain in self.state.chains.values() {
all_chain_blocks.reserve_exact(chain.blocks().len());
for (&number, block) in chain.blocks() {
all_chain_blocks.push(BlockNumHash { number, hash: block.hash() })
}