core/state: remove lock #18065 (#1174)

This commit is contained in:
Daniel Liu 2025-07-02 14:13:06 +08:00 committed by GitHub
parent 801e92b56d
commit 957e9d8d05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,7 +21,6 @@ import (
"fmt"
"math/big"
"sort"
"sync"
"time"
"github.com/XinFinOrg/XDPoSChain/common"
@ -82,8 +81,6 @@ type StateDB struct {
validRevisions []revision
nextRevisionId int
lock sync.Mutex
// Measurements gathered during execution for debugging purposes
AccountReads time.Duration
AccountHashes time.Duration
@ -630,9 +627,6 @@ func (db *StateDB) ForEachStorage(addr common.Address, cb func(key, value common
// Copy creates a deep, independent copy of the state.
// Snapshots of the copied state cannot be applied to the copy.
func (s *StateDB) Copy() *StateDB {
s.lock.Lock()
defer s.lock.Unlock()
// Copy all the basic fields, initialize the memory ones
state := &StateDB{
db: s.db,