Unverified Commit 870efeef authored by Felix Lange's avatar Felix Lange Committed by GitHub

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.
parent 144c1c6c
...@@ -22,7 +22,6 @@ import ( ...@@ -22,7 +22,6 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"sort" "sort"
"sync"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
...@@ -87,8 +86,6 @@ type StateDB struct { ...@@ -87,8 +86,6 @@ type StateDB struct {
journal *journal journal *journal
validRevisions []revision validRevisions []revision
nextRevisionId int nextRevisionId int
lock sync.Mutex
} }
// Create a new state from a given trie. // Create a new state from a given trie.
...@@ -496,9 +493,6 @@ func (db *StateDB) ForEachStorage(addr common.Address, cb func(key, value common ...@@ -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. // Copy creates a deep, independent copy of the state.
// Snapshots of the copied state cannot be applied to the copy. // Snapshots of the copied state cannot be applied to the copy.
func (self *StateDB) Copy() *StateDB { func (self *StateDB) Copy() *StateDB {
self.lock.Lock()
defer self.lock.Unlock()
// Copy all the basic fields, initialize the memory ones // Copy all the basic fields, initialize the memory ones
state := &StateDB{ state := &StateDB{
db: self.db, db: self.db,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment