diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 4c0ce4eaafa0..35c9812a201a 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -10,12 +10,12 @@ import ( "runtime/debug" "strings" - "github.com/tendermint/tendermint/mempool" - "github.com/gogo/protobuf/proto" abci "github.com/tendermint/tendermint/abci/types" + cfg "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/crypto/tmhash" "github.com/tendermint/tendermint/libs/log" + "github.com/tendermint/tendermint/mempool" tmhttp "github.com/tendermint/tendermint/rpc/client/http" tmtypes "github.com/tendermint/tendermint/types" dbm "github.com/tendermint/tm-db" @@ -63,13 +63,12 @@ func IsMempoolEnableSort() bool { } func IsMempoolEnableRecheck() bool { - return mempoolEnableRecheck + return cfg.DynamicConfig.GetMempoolRecheck() } -func SetGlobalMempool(mempool mempool.Mempool, enableSort bool, enableRecheck bool) { +func SetGlobalMempool(mempool mempool.Mempool, enableSort bool) { globalMempool = mempool mempoolEnableSort = enableSort - mempoolEnableRecheck = enableRecheck } type ( @@ -648,7 +647,7 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte, tx sdk.Tx, height int6 } else if height < startHeight && height != 0 { return gInfo, result, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("height(%d) should be greater than start block height(%d)", height, startHeight)) - } else { + } else { ctx = app.getContextForTx(mode, txBytes) } @@ -777,9 +776,9 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte, tx sdk.Tx, height int6 if mode == runTxModeCheck { exTxInfo := tx.GetTxInfo(ctx) - if exTxInfo.Nonce == 0 && exTxInfo.Sender != "" && app.AccHandler != nil{ + if exTxInfo.Nonce == 0 && exTxInfo.Sender != "" && app.AccHandler != nil { addr, _ := sdk.AccAddressFromBech32(exTxInfo.Sender) - exTxInfo.Nonce = app.AccHandler(ctx, addr) + exTxInfo.Nonce = app.AccHandler(ctx, addr) if app.anteHandler != nil && exTxInfo.Nonce > 0{ exTxInfo.Nonce -= 1 // in ante handler logical, the nonce will incress one diff --git a/server/start.go b/server/start.go index e1c34406b6ca..f822e3200654 100644 --- a/server/start.go +++ b/server/start.go @@ -4,14 +4,14 @@ package server import ( "fmt" - "github.com/cosmos/cosmos-sdk/store/iavl" "os" "runtime/pprof" "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client/lcd" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/iavl" + storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/tendermint/tendermint/abci/server" @@ -21,8 +21,6 @@ import ( "github.com/tendermint/tendermint/p2p" pvm "github.com/tendermint/tendermint/privval" "github.com/tendermint/tendermint/proxy" - - storetypes "github.com/cosmos/cosmos-sdk/store/types" ) // Tendermint full-node start flags @@ -56,7 +54,8 @@ const ( func StartCmd(ctx *Context, cdc *codec.Codec, appCreator AppCreator, registerRoutesFn func(restServer *lcd.RestServer), - registerAppFlagFn func(cmd *cobra.Command)) *cobra.Command { + registerAppFlagFn func(cmd *cobra.Command), + registerDynamicConfigFn func()) *cobra.Command { cmd := &cobra.Command{ Use: "start", Short: "Run the full node", @@ -83,6 +82,8 @@ For profiling and benchmarking purposes, CPU profiling can be enabled via the '- which accepts a path for the resulting pprof file. `, PreRunE: func(cmd *cobra.Command, args []string) error { + registerDynamicConfigFn() + _, err := GetPruningOptionsFromFlags() return err }, @@ -272,7 +273,7 @@ func startInProcess(ctx *Context, cdc *codec.Codec, appCreator AppCreator, go lcd.StartRestServer(cdc, registerRoutesFn, tmNode, viper.GetString(FlagListenAddr)) } - baseapp.SetGlobalMempool(tmNode.Mempool(), cfg.Mempool.SortTxByGp, cfg.Mempool.Recheck) + baseapp.SetGlobalMempool(tmNode.Mempool(), cfg.Mempool.SortTxByGp) // run forever (the node will not be returned) select {} diff --git a/server/util.go b/server/util.go index 41c9657368ec..2fdcda823e57 100644 --- a/server/util.go +++ b/server/util.go @@ -132,7 +132,8 @@ func AddCommands( rootCmd *cobra.Command, appCreator AppCreator, appExport AppExporter, registerRouters func(rs *lcd.RestServer), - registerAppFlagFn func(cmd *cobra.Command)) { + registerAppFlagFn func(cmd *cobra.Command), + registerDynamicConfigFn func()) { rootCmd.PersistentFlags().String("log_level", ctx.Config.LogLevel, "Log level") rootCmd.PersistentFlags().String("log_file", ctx.Config.LogFile, "Log file") @@ -151,7 +152,7 @@ func AddCommands( ) rootCmd.AddCommand( - StartCmd(ctx, cdc, appCreator, registerRouters, registerAppFlagFn), + StartCmd(ctx, cdc, appCreator, registerRouters, registerAppFlagFn, registerDynamicConfigFn), StopCmd(ctx), UnsafeResetAllCmd(ctx), flags.LineBreak,