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.
pull/17873/head
Felix Lange 6 years ago committed by GitHub
parent 144c1c6c52
commit 870efeef01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      core/state/statedb.go

@ -22,7 +22,6 @@ import (
"fmt"
"math/big"
"sort"
"sync"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
@ -87,8 +86,6 @@ type StateDB struct {
journal *journal
validRevisions []revision
nextRevisionId int
lock sync.Mutex
}
// Create a new state from a given trie.
@ -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,

Loading…
Cancel
Save