From 360e4ff07a3b2ad61c329ad56dc58a35144ebe0e Mon Sep 17 00:00:00 2001 From: Halimao <1065621723@qq.com> Date: Fri, 21 Jun 2024 21:35:51 +0800 Subject: [PATCH] fix: read from snap error should continue to read from db --- core/state/state_object.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/state/state_object.go b/core/state/state_object.go index 5c1dab53dc..2133e744c0 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -206,11 +206,13 @@ func (s *stateObject) GetCommittedState(key common.Hash) common.Hash { s.db.SnapshotStorageReads += time.Since(start) if len(enc) > 0 { - _, content, _, err := rlp.Split(enc) + var content []byte + _, content, _, err = rlp.Split(enc) if err != nil { 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.