Skip to content

Commit

Permalink
address previousHeight == 0 guard and nits
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Apr 8, 2022
1 parent 42adba1 commit d43a785
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pruning/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (m *Manager) ResetPruningHeights() {
// HandleHeight determines if pruneHeight height needs to be kept for pruning at the right interval prescribed by
// the pruning strategy. Returns true if the given height was kept to be pruned at the next call to Prune(), false otherwise
func (m *Manager) HandleHeight(previousHeight int64) int64 {
if m.opts.GetPruningStrategy() == types.PruningNothing {
if m.opts.GetPruningStrategy() == types.PruningNothing || previousHeight == 0 {
return 0
}

Expand Down
1 change: 0 additions & 1 deletion server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"

pruningtypes "github.com/cosmos/cosmos-sdk/pruning/types"
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
Expand Down
3 changes: 1 addition & 2 deletions store/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,8 +943,7 @@ func (rs *Store) RollbackToVersion(target int64) int64 {
for ; current > target; current-- {
rs.pruningManager.HandleHeight(current)
}
err := rs.pruneStores()
if err != nil {
if err := rs.pruneStores(); err != nil {
panic(err)
}

Expand Down

0 comments on commit d43a785

Please sign in to comment.