refactor!: migrate Cosmos SDK to CometBFT (#14897)
This commit is contained in:
+5
-2
@@ -3,14 +3,16 @@ package server
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
tmcmd "github.com/cometbft/cometbft/cmd/cometbft/commands"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/server/types"
|
||||
"github.com/spf13/cobra"
|
||||
tmcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
|
||||
)
|
||||
|
||||
// NewRollbackCmd creates a command to rollback tendermint and multistore state by one height.
|
||||
func NewRollbackCmd(appCreator types.AppCreator, defaultNodeHome string) *cobra.Command {
|
||||
var removeBlock bool
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "rollback",
|
||||
Short: "rollback cosmos-sdk and tendermint state by one height",
|
||||
@@ -32,7 +34,7 @@ application.
|
||||
}
|
||||
app := appCreator(ctx.Logger, db, nil, ctx.Viper)
|
||||
// rollback tendermint state
|
||||
height, hash, err := tmcmd.RollbackState(ctx.Config)
|
||||
height, hash, err := tmcmd.RollbackState(ctx.Config, removeBlock)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to rollback tendermint state: %w", err)
|
||||
}
|
||||
@@ -48,5 +50,6 @@ application.
|
||||
}
|
||||
|
||||
cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
|
||||
cmd.Flags().BoolVar(&removeBlock, "hard", false, "remove last block as well as state")
|
||||
return cmd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user