mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(trie): skip storing empty nibbles in storage trie (#2313)
This commit is contained in:
@ -190,18 +190,20 @@ impl<'a, 'tx, TX: DbTx<'tx> + DbTxMut<'tx>> StateRoot<'a, TX> {
|
||||
}
|
||||
}
|
||||
BranchNodeUpdate::Storage(hashed_address, nibbles, node) => {
|
||||
let key: StoredNibblesSubKey = nibbles.hex_data.into();
|
||||
if let Some(entry) =
|
||||
storage_cursor.seek_by_key_subkey(hashed_address, key.clone())?
|
||||
{
|
||||
// "seek exact"
|
||||
if entry.nibbles == key {
|
||||
storage_cursor.delete_current()?;
|
||||
if !nibbles.is_empty() {
|
||||
let key: StoredNibblesSubKey = nibbles.hex_data.into();
|
||||
if let Some(entry) =
|
||||
storage_cursor.seek_by_key_subkey(hashed_address, key.clone())?
|
||||
{
|
||||
// "seek exact"
|
||||
if entry.nibbles == key {
|
||||
storage_cursor.delete_current()?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
storage_cursor
|
||||
.upsert(hashed_address, StorageTrieEntry { nibbles: key, node })?;
|
||||
storage_cursor
|
||||
.upsert(hashed_address, StorageTrieEntry { nibbles: key, node })?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user