Revert "add : mutex for stateObjects"

This reverts commit 4d5cdae2e6.
This commit is contained in:
Jerry 2023-08-04 12:26:11 -07:00
parent 173a26f0c3
commit 3da36b08ff
No known key found for this signature in database
GPG key ID: 5B33FA23CB103211
2 changed files with 0 additions and 11 deletions

View file

@ -148,12 +148,7 @@ type (
) )
func (ch createObjectChange) revert(s *StateDB) { func (ch createObjectChange) revert(s *StateDB) {
s.stateObjectsMu.Lock()
delete(s.stateObjects, *ch.account) delete(s.stateObjects, *ch.account)
s.stateObjectsMu.Unlock()
delete(s.stateObjectsDirty, *ch.account) delete(s.stateObjectsDirty, *ch.account)
RevertWrite(s, blockstm.NewAddressKey(*ch.account)) RevertWrite(s, blockstm.NewAddressKey(*ch.account))
} }

View file

@ -22,7 +22,6 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"sort" "sort"
"sync"
"time" "time"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -79,7 +78,6 @@ type StateDB struct {
stateObjectsPending map[common.Address]struct{} // State objects finalized but not yet written to the trie stateObjectsPending map[common.Address]struct{} // State objects finalized but not yet written to the trie
stateObjectsDirty map[common.Address]struct{} // State objects modified in the current execution stateObjectsDirty map[common.Address]struct{} // State objects modified in the current execution
stateObjectsDestruct map[common.Address]struct{} // State objects destructed in the block stateObjectsDestruct map[common.Address]struct{} // State objects destructed in the block
stateObjectsMu sync.RWMutex
// Block-stm related fields // Block-stm related fields
mvHashmap *blockstm.MVHashMap mvHashmap *blockstm.MVHashMap
@ -156,7 +154,6 @@ func New(root common.Hash, db Database, snaps *snapshot.Tree) (*StateDB, error)
stateObjectsPending: make(map[common.Address]struct{}), stateObjectsPending: make(map[common.Address]struct{}),
stateObjectsDirty: make(map[common.Address]struct{}), stateObjectsDirty: make(map[common.Address]struct{}),
stateObjectsDestruct: make(map[common.Address]struct{}), stateObjectsDestruct: make(map[common.Address]struct{}),
stateObjectsMu: sync.RWMutex{},
revertedKeys: make(map[blockstm.Key]struct{}), revertedKeys: make(map[blockstm.Key]struct{}),
logs: make(map[common.Hash][]*types.Log), logs: make(map[common.Hash][]*types.Log),
preimages: make(map[common.Hash][]byte), preimages: make(map[common.Hash][]byte),
@ -1000,9 +997,6 @@ func (s *StateDB) getDeletedStateObject(addr common.Address) *stateObject {
} }
func (s *StateDB) setStateObject(object *stateObject) { func (s *StateDB) setStateObject(object *stateObject) {
s.stateObjectsMu.Lock()
defer s.stateObjectsMu.Unlock()
s.stateObjects[object.Address()] = object s.stateObjects[object.Address()] = object
} }