fix: use proper map key check in stateSet.revertTo

This commit is contained in:
Fallengirl 2025-12-13 19:58:40 +03:00 committed by GitHub
parent a9eaf2ffd8
commit 62c8752b85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -299,8 +299,8 @@ func (s *stateSet) revertTo(accountOrigin map[common.Hash][]byte, storageOrigin
} }
// Overwrite the storage data with original value blindly // Overwrite the storage data with original value blindly
for addrHash, storage := range storageOrigin { for addrHash, storage := range storageOrigin {
slots := s.storageData[addrHash] slots, ok := s.storageData[addrHash]
if len(slots) == 0 { if !ok {
panic(fmt.Sprintf("non-existent storage set for reverting, %x", addrHash)) panic(fmt.Sprintf("non-existent storage set for reverting, %x", addrHash))
} }
for storageHash, blob := range storage { for storageHash, blob := range storage {