Skip to content

Commit

Permalink
core/state/snapshot: add a missing lock (ethereum#30001)
Browse files Browse the repository at this point in the history
* upgrade lock usage

* revert unnecessary change
  • Loading branch information
mask-pp authored and ARR4N committed Feb 17, 2025
1 parent 42e699e commit beaa222
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/state/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ func (t *Tree) disklayer() *diskLayer {
case *diskLayer:
return layer
case *diffLayer:
layer.lock.RLock()
defer layer.lock.RUnlock()
return layer.origin
default:
panic(fmt.Sprintf("%T: undefined layer", snap))
Expand Down Expand Up @@ -863,7 +865,7 @@ func (t *Tree) generating() (bool, error) {
return layer.genMarker != nil, nil
}

// DiskRoot is a external helper function to return the disk layer root.
// DiskRoot is an external helper function to return the disk layer root.
func (t *Tree) DiskRoot() common.Hash {
t.lock.Lock()
defer t.lock.Unlock()
Expand Down

0 comments on commit beaa222

Please # to comment.