Skip to content

Commit

Permalink
chore: use-single-account-buf (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Dec 22, 2024
1 parent 9d3fdba commit e537f6c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ mod ethereum {
/// If the items are not in sorted order.
pub fn state_root<A: Into<TrieAccount>>(state: impl IntoIterator<Item = (B256, A)>) -> B256 {
let mut hb = HashBuilder::default();
let mut account_rlp_buf = Vec::new();
for (hashed_key, account) in state {
let account_rlp_buf = alloy_rlp::encode(account.into());
account_rlp_buf.clear();
account.into().encode(&mut account_rlp_buf);
hb.add_leaf(Nibbles::unpack(hashed_key), &account_rlp_buf);
}
hb.root()
Expand Down

0 comments on commit e537f6c

Please sign in to comment.