From dffde54e0c2991dffdb40441c3997902c285544e Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Fri, 9 Feb 2024 08:51:04 +0900 Subject: [PATCH] move the fix to LoadVersion --- mutable_tree.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mutable_tree.go b/mutable_tree.go index fd5395afc..12e2a0079 100644 --- a/mutable_tree.go +++ b/mutable_tree.go @@ -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, @@ -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()