mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-16 13:06:40 +00:00
core/state/snapshot: add a missing lock (#30001)
* upgrade lock usage * revert unnecessary change
This commit is contained in:
parent
fd5078c779
commit
34b46a2f75
1 changed files with 3 additions and 1 deletions
|
|
@ -829,6 +829,8 @@ func (t *Tree) disklayer() *diskLayer {
|
||||||
case *diskLayer:
|
case *diskLayer:
|
||||||
return layer
|
return layer
|
||||||
case *diffLayer:
|
case *diffLayer:
|
||||||
|
layer.lock.RLock()
|
||||||
|
defer layer.lock.RUnlock()
|
||||||
return layer.origin
|
return layer.origin
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("%T: undefined layer", snap))
|
panic(fmt.Sprintf("%T: undefined layer", snap))
|
||||||
|
|
@ -860,7 +862,7 @@ func (t *Tree) generating() (bool, error) {
|
||||||
return layer.genMarker != nil, nil
|
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 {
|
func (t *Tree) DiskRoot() common.Hash {
|
||||||
t.lock.Lock()
|
t.lock.Lock()
|
||||||
defer t.lock.Unlock()
|
defer t.lock.Unlock()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue