chore: early return EMPTY_ROOT_HASH (#10957)

This commit is contained in:
DaniPopes
2024-09-17 15:45:47 +02:00
committed by GitHub
parent b5fcc1baeb
commit ad76d89a27
2 changed files with 7 additions and 4 deletions

View File

@ -28,6 +28,10 @@ pub fn ordered_trie_root_with_encoder<T, F>(items: &[T], mut encode: F) -> B256
where
F: FnMut(&T, &mut Vec<u8>),
{
if items.is_empty() {
return alloy_trie::EMPTY_ROOT_HASH;
}
let mut value_buffer = Vec::new();
let mut hb = HashBuilder::default();