mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
chore(trie): prefer accepting IntoIterator args (#6772)
This commit is contained in:
@@ -243,7 +243,7 @@ impl Chain {
|
||||
fn append_trie_updates(&mut self, other_trie_updates: Option<TrieUpdates>) {
|
||||
if let Some((trie_updates, other)) = self.trie_updates.as_mut().zip(other_trie_updates) {
|
||||
// Extend trie updates.
|
||||
trie_updates.extend(other.into_iter());
|
||||
trie_updates.extend(other);
|
||||
} else {
|
||||
// Reset trie updates as they are no longer valid.
|
||||
self.trie_updates.take();
|
||||
|
||||
@@ -259,7 +259,7 @@ where
|
||||
let (root, storage_slots_walked, updates) =
|
||||
storage_root_calculator.root_with_updates()?;
|
||||
hashed_entries_walked += storage_slots_walked;
|
||||
trie_updates.extend(updates.into_iter());
|
||||
trie_updates.extend(updates);
|
||||
root
|
||||
} else {
|
||||
storage_root_calculator.root()?
|
||||
@@ -286,7 +286,7 @@ where
|
||||
last_account_key: hashed_address,
|
||||
};
|
||||
|
||||
trie_updates.extend(walker_updates.into_iter());
|
||||
trie_updates.extend(walker_updates);
|
||||
trie_updates.extend_with_account_updates(hash_builder_updates);
|
||||
|
||||
return Ok(StateRootProgress::Progress(
|
||||
@@ -304,7 +304,7 @@ where
|
||||
let (_, walker_updates) = account_node_iter.walker.split();
|
||||
let (_, hash_builder_updates) = hash_builder.split();
|
||||
|
||||
trie_updates.extend(walker_updates.into_iter());
|
||||
trie_updates.extend(walker_updates);
|
||||
trie_updates.extend_with_account_updates(hash_builder_updates);
|
||||
trie_updates.extend_with_deletes(
|
||||
self.prefix_sets.destroyed_accounts.into_iter().map(TrieKey::StorageTrie),
|
||||
@@ -455,7 +455,7 @@ where
|
||||
let (_, walker_updates) = storage_node_iter.walker.split();
|
||||
|
||||
let mut trie_updates = TrieUpdates::default();
|
||||
trie_updates.extend(walker_updates.into_iter());
|
||||
trie_updates.extend(walker_updates);
|
||||
trie_updates.extend_with_storage_updates(self.hashed_address, hash_builder_updates);
|
||||
|
||||
trace!(target: "trie::storage_root", ?root, hashed_address = ?self.hashed_address, "calculated storage root");
|
||||
|
||||
@@ -75,7 +75,7 @@ impl TrieUpdates {
|
||||
}
|
||||
|
||||
/// Extend the updates with trie updates.
|
||||
pub fn extend(&mut self, updates: impl Iterator<Item = (TrieKey, TrieOp)>) {
|
||||
pub fn extend(&mut self, updates: impl IntoIterator<Item = (TrieKey, TrieOp)>) {
|
||||
self.trie_operations.extend(updates);
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@ impl TrieUpdates {
|
||||
}
|
||||
|
||||
/// Extend the updates with deletes.
|
||||
pub fn extend_with_deletes(&mut self, keys: impl Iterator<Item = TrieKey>) {
|
||||
self.extend(keys.map(|key| (key, TrieOp::Delete)));
|
||||
pub fn extend_with_deletes(&mut self, keys: impl IntoIterator<Item = TrieKey>) {
|
||||
self.extend(keys.into_iter().map(|key| (key, TrieOp::Delete)));
|
||||
}
|
||||
|
||||
/// Flush updates all aggregated updates to the database.
|
||||
|
||||
Reference in New Issue
Block a user