Skip to content

Commit

Permalink
Tulasi/export homepath (#8194)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
4 people authored Dec 18, 2020
1 parent 75bc312 commit f602e9e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"errors"
"io"
"os"
"path/filepath"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f602e9e

Please sign in to comment.