fix: read from snap error should continue to read from db

This commit is contained in:
Halimao 2024-06-21 21:35:51 +08:00
parent a71f6f91fd
commit 360e4ff07a

View file

@ -206,11 +206,13 @@ func (s *stateObject) GetCommittedState(key common.Hash) common.Hash {
s.db.SnapshotStorageReads += time.Since(start) s.db.SnapshotStorageReads += time.Since(start)
if len(enc) > 0 { if len(enc) > 0 {
_, content, _, err := rlp.Split(enc) var content []byte
_, content, _, err = rlp.Split(enc)
if err != nil { if err != nil {
s.db.setError(err) s.db.setError(err)
} else {
value.SetBytes(content)
} }
value.SetBytes(content)
} }
} }
// If the snapshot is unavailable or reading from it fails, load from the database. // If the snapshot is unavailable or reading from it fails, load from the database.