core/state/snapshot: add a missing lock (#30001)

* upgrade lock usage

* revert unnecessary change
pull/30012/head
maskpp 3 months ago committed by GitHub
parent fd5078c779
commit 34b46a2f75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      core/state/snapshot/snapshot.go

@ -829,6 +829,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))
@ -860,7 +862,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()

Loading…
Cancel
Save