From 4be66ee9cb34d95ffd75176b59dbc6938763424a Mon Sep 17 00:00:00 2001 From: "alex.sharov" <AskAlexSharov@gmail.com> Date: Sat, 3 Jul 2021 17:38:58 +0700 Subject: [PATCH] Revert "save" This reverts commit 6eed73566d8aff4c1c7f026997474e148c246c7c. --- core/state/history.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/state/history.go b/core/state/history.go index 2ba952c0a2..9be79364b2 100644 --- a/core/state/history.go +++ b/core/state/history.go @@ -16,9 +16,12 @@ import ( ) func GetAsOf(tx ethdb.Tx, storage bool, key []byte, timestamp uint64) ([]byte, error) { + var dat []byte v, err := FindByHistory(tx, storage, key, timestamp) if err == nil { - return v, nil + dat = make([]byte, len(v)) + copy(dat, v) + return dat, nil } if !errors.Is(err, ethdb.ErrKeyNotFound) { return nil, err @@ -27,7 +30,12 @@ func GetAsOf(tx ethdb.Tx, storage bool, key []byte, timestamp uint64) ([]byte, e if err != nil { return nil, err } - return v, nil + if v == nil { + return nil, nil + } + dat = make([]byte, len(v)) + copy(dat, v) + return dat, nil } func FindByHistory(tx ethdb.Tx, storage bool, key []byte, timestamp uint64) ([]byte, error) { -- GitLab