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:
NagaTulasi 2020-12-18 14:36:54 +05:30 committed by GitHub
parent 75bc312ffd
commit f602e9e977
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package cmd
import (
"errors"
"io"
"os"
"path/filepath"
@ -204,14 +205,20 @@ func createSimappAndExport(
encCfg := simapp.MakeTestEncodingConfig() // Ideally, we would reuse the one created by NewRootCmd.
encCfg.Marshaler = codec.NewProtoCodec(encCfg.InterfaceRegistry)
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 {
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 {
return servertypes.ExportedApp{}, err
}
} 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)