Skip to content

Commit

Permalink
cli: patch cometbft to support rollbacks of >1 block
Browse files Browse the repository at this point in the history
  • Loading branch information
pirtleshell committed Nov 22, 2023
1 parent b8317d8 commit a7da156
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ replace (
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/jhump/protoreflect => github.com/jhump/protoreflect v1.9.0
// use cometbft
github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.27
// github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.27
github.com/tendermint/tendermint => github.com/kava-labs/cometbft v0.34.28-0.20231117215347-3ba44e0f4151
)

retract (
Expand Down
5 changes: 4 additions & 1 deletion server/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (

// 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",
Expand All @@ -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)
}
Expand All @@ -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
}

0 comments on commit a7da156

Please sign in to comment.