From bf04a6e73d95af0734f1287e5350e8b339f7bdf9 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Fri, 5 Feb 2021 16:46:43 +0700 Subject: [PATCH] make_history_check_optional (#1467) --- cmd/integration/commands/state_stages.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cmd/integration/commands/state_stages.go b/cmd/integration/commands/state_stages.go index f3380e060..c6f30601a 100644 --- a/cmd/integration/commands/state_stages.go +++ b/cmd/integration/commands/state_stages.go @@ -195,7 +195,7 @@ func syncBySmallSteps(db ethdb.Database, ctx context.Context) error { if err := st.Run(db, tx); err != nil { return err } - if err := checkChanges(expectedAccountChanges, tx, expectedStorageChanges, execAtBlock); err != nil { + if err := checkChanges(expectedAccountChanges, tx, expectedStorageChanges, execAtBlock, sm.History); err != nil { return err } @@ -226,7 +226,7 @@ func syncBySmallSteps(db ethdb.Database, ctx context.Context) error { return nil } -func checkChanges(expectedAccountChanges map[uint64]*changeset.ChangeSet, db ethdb.Database, expectedStorageChanges map[uint64]*changeset.ChangeSet, execAtBlock uint64) error { +func checkChanges(expectedAccountChanges map[uint64]*changeset.ChangeSet, db ethdb.Database, expectedStorageChanges map[uint64]*changeset.ChangeSet, execAtBlock uint64, historyEnabled bool) error { for blockN := range expectedAccountChanges { if err := checkChangeSet(db, blockN, expectedAccountChanges[blockN], expectedStorageChanges[blockN]); err != nil { return err @@ -235,11 +235,13 @@ func checkChanges(expectedAccountChanges map[uint64]*changeset.ChangeSet, db eth delete(expectedStorageChanges, blockN) } - if err := checkHistory(db, dbutils.PlainAccountChangeSetBucket, execAtBlock); err != nil { - return err - } - if err := checkHistory(db, dbutils.PlainStorageChangeSetBucket, execAtBlock); err != nil { - return err + if historyEnabled { + if err := checkHistory(db, dbutils.PlainAccountChangeSetBucket, execAtBlock); err != nil { + return err + } + if err := checkHistory(db, dbutils.PlainStorageChangeSetBucket, execAtBlock); err != nil { + return err + } } return nil }