Skip to content

Commit

Permalink
move the fix to LoadVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Feb 8, 2024
1 parent b2a2fc0 commit dffde54
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mutable_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func NewMutableTree(db dbm.DB, cacheSize int, skipFastStorageUpgrade bool, lg lo
}

ndb := newNodeDB(db, cacheSize, opts, lg)
head := &ImmutableTree{ndb: ndb, skipFastStorageUpgrade: skipFastStorageUpgrade, version: int64(opts.InitialVersion)}
head := &ImmutableTree{ndb: ndb, skipFastStorageUpgrade: skipFastStorageUpgrade}

return &MutableTree{
logger: lg,
Expand Down Expand Up @@ -460,6 +460,8 @@ func (tree *MutableTree) LoadVersion(targetVersion int64) (int64, error) {

if firstVersion == 0 {
if targetVersion <= 0 {
tree.version = int64(tree.ndb.opts.InitialVersion)

if !tree.skipFastStorageUpgrade {
tree.mtx.Lock()
defer tree.mtx.Unlock()
Expand Down

0 comments on commit dffde54

Please sign in to comment.