From f602e9e9776ea37d5b1ac46b724cbf81dff4dd90 Mon Sep 17 00:00:00 2001 From: NagaTulasi <40757909+NagaTulasi@users.noreply.github.com> Date: Fri, 18 Dec 2020 14:36:54 +0530 Subject: [PATCH] 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 Co-authored-by: Alessio Treglia Co-authored-by: Alessio Treglia --- simapp/simd/cmd/root.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go index dd33ea0823f7..534e22b0fb0d 100644 --- a/simapp/simd/cmd/root.go +++ b/simapp/simd/cmd/root.go @@ -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)