fix(trie): skip cleared storage database lookup on InMemoryStorageTrieCursor::next (#10412)

This commit is contained in:
Roman Krasiuk
2024-08-21 02:37:02 -07:00
committed by GitHub
parent 457439ea2b
commit 1e52ef9486

View File

@ -221,6 +221,9 @@ impl<'a, C: TrieCursor> InMemoryStorageTrieCursor<'a, C> {
last: Nibbles,
) -> Result<Option<(Nibbles, BranchNodeCompact)>, DatabaseError> {
let in_memory = self.in_memory_cursor.as_mut().and_then(|c| c.first_after(&last));
if self.storage_trie_cleared {
return Ok(in_memory)
}
// Reposition the cursor to the first greater or equal node that wasn't removed.
let mut db_entry = self.cursor.seek(last.clone())?;