Skip to content

Commit

Permalink
state: State.MainTreeView also needs to respect v.tx.RLock()
Browse files Browse the repository at this point in the history
  • Loading branch information
altergui committed Sep 19, 2023
1 parent 15aa0de commit 6053601
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vochain/state/trees.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ type treeTxWithMutex struct {
// MainTreeView is a thread-safe function to obtain a pointer to the last
// opened mainTree as a TreeView.
func (v *State) MainTreeView() *statedb.TreeView {
v.tx.RLock()
defer v.tx.RUnlock()
return v.mainTreeViewValue.Load()
}

Expand Down

0 comments on commit 6053601

Please sign in to comment.