Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapshot: upgrade lock usage #30001

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/state/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,8 @@ func (t *Tree) disklayer() *diskLayer {
case *diskLayer:
return layer
case *diffLayer:
layer.lock.RLock()
defer layer.lock.RUnlock()
mask-pp marked this conversation as resolved.
Show resolved Hide resolved
return layer.origin
default:
panic(fmt.Sprintf("%T: undefined layer", snap))
Expand Down Expand Up @@ -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()
Expand Down