Skip to content

Commit 34b46a2

Browse files
authored
core/state/snapshot: add a missing lock (#30001)
* upgrade lock usage * revert unnecessary change
1 parent fd5078c commit 34b46a2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/state/snapshot/snapshot.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,8 @@ func (t *Tree) disklayer() *diskLayer {
829829
case *diskLayer:
830830
return layer
831831
case *diffLayer:
832+
layer.lock.RLock()
833+
defer layer.lock.RUnlock()
832834
return layer.origin
833835
default:
834836
panic(fmt.Sprintf("%T: undefined layer", snap))
@@ -860,7 +862,7 @@ func (t *Tree) generating() (bool, error) {
860862
return layer.genMarker != nil, nil
861863
}
862864

863-
// DiskRoot is a external helper function to return the disk layer root.
865+
// DiskRoot is an external helper function to return the disk layer root.
864866
func (t *Tree) DiskRoot() common.Hash {
865867
t.lock.Lock()
866868
defer t.lock.Unlock()

0 commit comments

Comments
 (0)