core/state/snapshot: add a missing lock (#30001)
* upgrade lock usage * revert unnecessary change
This commit is contained in:
parent
fd5078c779
commit
34b46a2f75
@ -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…
Reference in New Issue
Block a user