Skip to content

Commit

Permalink
core/state: remove lock (#18065)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fjl authored Nov 8, 2018
1 parent 144c1c6 commit 870efee
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"fmt"
"math/big"
"sort"
"sync"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
Expand Down Expand Up @@ -87,8 +86,6 @@ type StateDB struct {
journal *journal
validRevisions []revision
nextRevisionId int

lock sync.Mutex
}

// Create a new state from a given trie.
Expand Down Expand Up @@ -496,9 +493,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 (self *StateDB) Copy() *StateDB {
self.lock.Lock()
defer self.lock.Unlock()

// Copy all the basic fields, initialize the memory ones
state := &StateDB{
db: self.db,
Expand Down

0 comments on commit 870efee

Please sign in to comment.