diff --git a/core/blockchain.go b/core/blockchain.go index 90e290f2d1..807c71c727 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -244,10 +244,8 @@ type txLookup struct { // included in the canonical one where as GetBlockByNumber always represents the // canonical chain. type BlockChain struct { - chainConfig *params.ChainConfig // Chain & network configuration - cacheConfig *CacheConfig // Cache configuration for pruning - - hasBadBlock bool + chainConfig *params.ChainConfig // Chain & network configuration + cacheConfig *CacheConfig // Cache configuration for pruning db ethdb.Database // Low level persistent database to store final content in snaps *snapshot.Tree // Snapshot tree for fast trie leaf access triegc *prque.Prque[int64, common.Hash] // Priority queue mapping block numbers to tries to gc diff --git a/core/state/shared_pool.go b/core/state/shared_pool.go index 5ae1015499..fff28bddab 100644 --- a/core/state/shared_pool.go +++ b/core/state/shared_pool.go @@ -50,8 +50,8 @@ func (s *StoragePool) getStorage(address common.Address) *sync.Map { // CacheAmongBlocks is used to store difflayer data in a flat cache, // it only stores the latest version of the data type CacheAmongBlocks struct { - cacheRoot common.Hash - sMux sync.Mutex // TODO use mutex to update the cache if pipeline used the cache + cacheRoot common.Hash + // sMux sync.Mutex // TODO use mutex to update the cache if pipeline used the cache accountsCache *fastcache.Cache storagesCache *fastcache.Cache } diff --git a/core/state/state_object.go b/core/state/state_object.go index 959a6c2d50..dd8b655843 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -241,7 +241,6 @@ func (s *stateObject) GetCommittedState(key common.Hash) common.Hash { } else { SnapshotBlockCacheStorageMissMeter.Mark(1) } - } if !exist { enc, err = s.db.snap.Storage(s.addrHash, storageKey) diff --git a/core/state/statedb.go b/core/state/statedb.go index 741d6307fb..f600365b63 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -49,8 +49,6 @@ const ( storageDeleteLimit = 512 * 1024 * 1024 ) -var HasBadBlock bool - type revision struct { id int journalIndex int @@ -69,7 +67,6 @@ type revision struct { // commit states. type StateDB struct { db Database - hasbadblock bool prefetcherLock sync.Mutex prefetcher *triePrefetcher trie Trie @@ -751,7 +748,7 @@ func (s *StateDB) getDeletedStateObject(addr common.Address) *stateObject { SnapshotBlockCacheAccountMissMeter.Mark(1) } } - if exist == false { + if !exist { acc, err = s.snap.Account(accounthash) if metrics.EnabledExpensive { s.SnapshotAccountReads += time.Since(start) @@ -762,7 +759,6 @@ func (s *StateDB) getDeletedStateObject(addr common.Address) *stateObject { } } } - if err == nil || exist { data = &types.StateAccount{ Nonce: acc.Nonce, @@ -1822,7 +1818,6 @@ func (s *StateDB) SnapToDiffLayer() ([]common.Address, []types.DiffAccount, []ty s.cacheAmongBlocks.PurgeStorageCache() } } - } accounts := make([]types.DiffAccount, 0, len(s.accounts))