fix: create snapshot dir for rocksdb backend (#15054)

This commit is contained in:
yihuang 2023-02-18 01:05:40 +08:00 committed by GitHub
parent 0debb58c0b
commit 497dc2cb78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -444,6 +444,10 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) {
}
snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots")
if err = os.MkdirAll(snapshotDir, os.ModePerm); err != nil {
panic(fmt.Errorf("failed to create snapshots directory: %w", err))
}
snapshotDB, err := dbm.NewDB("metadata", GetAppDBBackend(appOpts), snapshotDir)
if err != nil {
panic(err)