Skip to content

Commit

Permalink
Add QMS for online migration (#1870)
Browse files Browse the repository at this point in the history
* Add QMS for online migration

* Fix lint

---------

Co-authored-by: kbhat1 <[email protected]>
  • Loading branch information
yzang2019 and Kbhat1 committed Oct 29, 2024
1 parent 0c91538 commit a3121e2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/seidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const (

// Other configs
FlagSnapshotInterval = "state-sync.snapshot-interval"
FlagMigrateIAVL = "migrate-iavl"
FlagMigrateHeight = "migrate-height"
)

func SetupSeiDB(
Expand All @@ -58,8 +60,15 @@ func SetupSeiDB(
// cms must be overridden before the other options, because they may use the cms,
// make sure the cms aren't be overridden by the other options later on.
cms := rootmulti.NewStore(homePath, logger, scConfig, ssConfig)
migrationEnabled := cast.ToBool(appOpts.Get(FlagMigrateIAVL))
migrationHeight := cast.ToInt64(appOpts.Get(FlagMigrateHeight))
baseAppOptions = append([]func(*baseapp.BaseApp){
func(baseApp *baseapp.BaseApp) {
if migrationEnabled {
originalCMS := baseApp.CommitMultiStore()
baseApp.SetQueryMultiStore(originalCMS)
baseApp.SetMigrationHeight(migrationHeight)
}
baseApp.SetCMS(cms)
},
}, baseAppOptions...)
Expand Down

0 comments on commit a3121e2

Please sign in to comment.