Skip to content

Commit ac3444d

Browse files
mask-ppARR4N
authored andcommitted
core/state/snapshot: add a missing lock (ethereum#30001)
* upgrade lock usage * revert unnecessary change
1 parent 3db5bea commit ac3444d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/state/snapshot/snapshot.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,8 @@ func (t *Tree) disklayer() *diskLayer {
832832
case *diskLayer:
833833
return layer
834834
case *diffLayer:
835+
layer.lock.RLock()
836+
defer layer.lock.RUnlock()
835837
return layer.origin
836838
default:
837839
panic(fmt.Sprintf("%T: undefined layer", snap))
@@ -863,7 +865,7 @@ func (t *Tree) generating() (bool, error) {
863865
return layer.genMarker != nil, nil
864866
}
865867

866-
// DiskRoot is a external helper function to return the disk layer root.
868+
// DiskRoot is an external helper function to return the disk layer root.
867869
func (t *Tree) DiskRoot() common.Hash {
868870
t.lock.Lock()
869871
defer t.lock.Unlock()

0 commit comments

Comments
 (0)