feat: migrate x/crisis use app wiring (#12389)
Co-authored-by: JeancarloBarrios <jeancarlobarrios@users.noreply.github.com>
This commit is contained in:
co-authored by
JeancarloBarrios
parent
17dc431666
commit
77cf43009a
+12
-3
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/spf13/cast"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
tmcfg "github.com/tendermint/tendermint/config"
|
||||
tmcli "github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
@@ -278,7 +279,6 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a
|
||||
|
||||
return simapp.NewSimApp(
|
||||
logger, db, traceStore, true,
|
||||
cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
|
||||
a.encCfg,
|
||||
appOpts,
|
||||
baseapp.SetPruning(pruningOpts),
|
||||
@@ -307,14 +307,23 @@ func (a appCreator) appExport(
|
||||
return servertypes.ExportedApp{}, errors.New("application home not set")
|
||||
}
|
||||
|
||||
viperAppOpts, ok := appOpts.(*viper.Viper)
|
||||
if !ok {
|
||||
return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper")
|
||||
}
|
||||
|
||||
// overwrite the FlagInvCheckPeriod
|
||||
viperAppOpts.Set(server.FlagInvCheckPeriod, 1)
|
||||
appOpts = viperAppOpts
|
||||
|
||||
if height != -1 {
|
||||
simApp = simapp.NewSimApp(logger, db, traceStore, false, uint(1), a.encCfg, appOpts)
|
||||
simApp = simapp.NewSimApp(logger, db, traceStore, false, a.encCfg, appOpts)
|
||||
|
||||
if err := simApp.LoadHeight(height); err != nil {
|
||||
return servertypes.ExportedApp{}, err
|
||||
}
|
||||
} else {
|
||||
simApp = simapp.NewSimApp(logger, db, traceStore, true, uint(1), a.encCfg, appOpts)
|
||||
simApp = simapp.NewSimApp(logger, db, traceStore, true, a.encCfg, appOpts)
|
||||
}
|
||||
|
||||
return simApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs)
|
||||
|
||||
Reference in New Issue
Block a user