Tulasi/export homepath (#8194)
* homepath added * temp added * changes done * modified * modified * Update simapp/simd/cmd/root.go * Update simapp/simd/cmd/root.go * Update simapp/simd/cmd/root.go Co-authored-by: Naga Tulasi <tulasi@vitwit.xyz> Co-authored-by: Alessio Treglia <alessio@tendermint.com> Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>
This commit is contained in:
parent
75bc312ffd
commit
f602e9e977
|
@ -1,6 +1,7 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -204,14 +205,20 @@ func createSimappAndExport(
|
||||||
encCfg := simapp.MakeTestEncodingConfig() // Ideally, we would reuse the one created by NewRootCmd.
|
encCfg := simapp.MakeTestEncodingConfig() // Ideally, we would reuse the one created by NewRootCmd.
|
||||||
encCfg.Marshaler = codec.NewProtoCodec(encCfg.InterfaceRegistry)
|
encCfg.Marshaler = codec.NewProtoCodec(encCfg.InterfaceRegistry)
|
||||||
var simApp *simapp.SimApp
|
var simApp *simapp.SimApp
|
||||||
|
|
||||||
|
homePath, ok := appOpts.Get(flags.FlagHome).(string)
|
||||||
|
if !ok || homePath == "" {
|
||||||
|
return servertypes.ExportedApp{}, errors.New("application home not set")
|
||||||
|
}
|
||||||
|
|
||||||
if height != -1 {
|
if height != -1 {
|
||||||
simApp = simapp.NewSimApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1), encCfg, appOpts)
|
simApp = simapp.NewSimApp(logger, db, traceStore, false, map[int64]bool{}, homePath, uint(1), encCfg, appOpts)
|
||||||
|
|
||||||
if err := simApp.LoadHeight(height); err != nil {
|
if err := simApp.LoadHeight(height); err != nil {
|
||||||
return servertypes.ExportedApp{}, err
|
return servertypes.ExportedApp{}, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
simApp = simapp.NewSimApp(logger, db, traceStore, true, map[int64]bool{}, "", uint(1), encCfg, appOpts)
|
simApp = simapp.NewSimApp(logger, db, traceStore, true, map[int64]bool{}, homePath, uint(1), encCfg, appOpts)
|
||||||
}
|
}
|
||||||
|
|
||||||
return simApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs)
|
return simApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs)
|
||||||
|
|
Loading…
Reference in New Issue