Skip to content

Commit

Permalink
fix(cosmos): use dedicated dedicate app creator for non start commands
Browse files Browse the repository at this point in the history
  • Loading branch information
mhofman committed Jun 23, 2024
1 parent 2a3976e commit 84208e9
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions golang/cosmos/daemon/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ func initRootCmd(sender vm.Sender, rootCmd *cobra.Command, encodingConfig params
testnetCmd(gaia.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
config.Cmd(),
pruning.Cmd(ac.newApp, gaia.DefaultNodeHome),
snapshot.Cmd(ac.newApp),
pruning.Cmd(ac.newSnapshotsApp, gaia.DefaultNodeHome),
snapshot.Cmd(ac.newSnapshotsApp),
)

server.AddCommands(rootCmd, gaia.DefaultNodeHome, ac.newApp, ac.appExport, addModuleInitFlags)
Expand Down Expand Up @@ -287,6 +287,33 @@ func (ac appCreator) newApp(
)
}

func (ac appCreator) newSnapshotsApp(
logger log.Logger,
db dbm.DB,
traceStore io.Writer,
appOpts servertypes.AppOptions,
) servertypes.Application {
if OnExportHook != nil {
if err := OnExportHook(ac.agdServer, logger, appOpts); err != nil {
panic(err)
}
}

baseappOptions := server.DefaultBaseappOptions(appOpts)

homePath := cast.ToString(appOpts.Get(flags.FlagHome))

return gaia.NewAgoricApp(
ac.sender, ac.agdServer,
logger, db, traceStore, true, map[int64]bool{},
homePath,
cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
ac.encCfg,
appOpts,
baseappOptions...,
)
}

const (
// FlagExportDir is the command-line flag for the "export" command specifying
// where the output of the export should be placed. It contains both the
Expand Down

0 comments on commit 84208e9

Please sign in to comment.