Skip to content

Commit 870efee

Browse files
authored
core/state: remove lock (#18065)
The lock in StateDB is useless. It's only held in Copy, but Copy is safe for concurrent use because all it does is read.
1 parent 144c1c6 commit 870efee

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

core/state/statedb.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"fmt"
2323
"math/big"
2424
"sort"
25-
"sync"
2625

2726
"github.com/ethereum/go-ethereum/common"
2827
"github.com/ethereum/go-ethereum/core/types"
@@ -87,8 +86,6 @@ type StateDB struct {
8786
journal *journal
8887
validRevisions []revision
8988
nextRevisionId int
90-
91-
lock sync.Mutex
9289
}
9390

9491
// Create a new state from a given trie.
@@ -496,9 +493,6 @@ func (db *StateDB) ForEachStorage(addr common.Address, cb func(key, value common
496493
// Copy creates a deep, independent copy of the state.
497494
// Snapshots of the copied state cannot be applied to the copy.
498495
func (self *StateDB) Copy() *StateDB {
499-
self.lock.Lock()
500-
defer self.lock.Unlock()
501-
502496
// Copy all the basic fields, initialize the memory ones
503497
state := &StateDB{
504498
db: self.db,

0 commit comments

Comments
 (0)