diff --git a/mutable_tree.go b/mutable_tree.go index 2bba51184..2d74554cb 100644 --- a/mutable_tree.go +++ b/mutable_tree.go @@ -37,7 +37,7 @@ type MutableTree struct { unsavedFastNodeRemovals map[string]interface{} // FastNodes that have not yet been removed from disk ndb *nodeDB - mtx sync.RWMutex // versions Read/write lock. + mtx sync.Mutex } // NewMutableTree returns a new tree with the specified cache size and datastore. @@ -88,8 +88,8 @@ func (tree *MutableTree) VersionExists(version int64) bool { // AvailableVersions returns all available versions in ascending order func (tree *MutableTree) AvailableVersions() []int { - tree.mtx.RLock() - defer tree.mtx.RUnlock() + tree.mtx.Lock() + defer tree.mtx.Unlock() res := make([]int, 0, len(tree.versions)) for i, v := range tree.versions {