Skip to content

Commit

Permalink
Parallel2.0: fix some minor rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
setunapo authored and brilliant-lx committed Oct 1, 2022
1 parent c83a843 commit 38920f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 5 additions & 3 deletions core/state/state_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ type StateObject struct {
trie Trie // storage trie, which becomes non-nil on first access
code Code // contract bytecode, which gets set when code is loaded

isParallel bool // isParallel indicates this state object is used in parallel mode
sharedOriginStorage *sync.Map // Storage cache of original entries to dedup rewrites, reset for every transaction
// isParallel indicates this state object is used in parallel mode, in which mode the
// storage would be sync.Map instead of map
isParallel bool
sharedOriginStorage *sync.Map // Point to the entry of the stateObject in sharedPool
originStorage Storage // Storage cache of original entries to dedup rewrites, reset for every transaction
pendingStorage Storage // Storage entries that need to be flushed to disk, at the end of an entire block
dirtyStorage Storage // Storage entries that have been modified in the current transaction execution
Expand Down Expand Up @@ -382,8 +384,8 @@ func (s *StateObject) GetCommittedState(db Database, key common.Hash) common.Has
s.db.snapParallelLock.RUnlock()
return common.Hash{}
}
start := time.Now()
s.db.snapParallelLock.RUnlock()
start := time.Now()
enc, err = s.db.snap.Storage(s.addrHash, crypto.Keccak256Hash(key.Bytes()))
if metrics.EnabledExpensive {
s.db.SnapshotStorageReads += time.Since(start)
Expand Down
3 changes: 1 addition & 2 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ type StateDB struct {
fullProcessed bool
pipeCommit bool

snapMux sync.Mutex
snaps *snapshot.Tree
snap snapshot.Snapshot
snapAccountMux sync.Mutex // Mutex for snap account access
Expand Down Expand Up @@ -358,7 +357,7 @@ func (s *StateDB) StopPrefetcher() {
}

func (s *StateDB) TriePrefetchInAdvance(block *types.Block, signer types.Signer) {
// s is a temporary throw away StateDB, s.prefetcher won't be resetted to nil
// s is a temporary throw away StateDB, s.prefetcher won't be reset to nil
// so no need to add lock for s.prefetcher
prefetcher := s.prefetcher
if prefetcher == nil {
Expand Down

0 comments on commit 38920f5

Please sign in to comment.