Skip to content

Commit

Permalink
refactor halt
Browse files Browse the repository at this point in the history
  • Loading branch information
facundomedica committed Aug 12, 2024
1 parent 4dc9469 commit 934905b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,10 +914,10 @@ func (app *BaseApp) FinalizeBlock(req *abci.FinalizeBlockRequest) (res *abci.Fin
func (app *BaseApp) checkHalt(height int64, time time.Time) error {
var halt bool
switch {
case app.haltHeight > 0 && uint64(height) > app.haltHeight:
case app.haltHeight > 0 && uint64(height) >= app.haltHeight:
halt = true

case app.haltTime > 0 && time.Unix() > int64(app.haltTime):
case app.haltTime > 0 && time.Unix() >= int64(app.haltTime):
halt = true
}

Expand Down
8 changes: 5 additions & 3 deletions baseapp/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2257,9 +2257,11 @@ func TestABCI_HaltChain(t *testing.T) {
expHalt bool
}{
{"default", 0, 0, 10, 0, false},
{"halt-height-edge", 10, 0, 10, 0, false},
{"halt-height", 10, 0, 11, 0, true},
{"halt-time-edge", 0, 10, 1, 10, false},
{"halt-height-edge", 11, 0, 10, 0, false},
{"halt-height-equal", 10, 0, 10, 0, true},
{"halt-height", 10, 0, 10, 0, true},
{"halt-time-edge", 0, 11, 1, 10, false},
{"halt-time-equal", 0, 10, 1, 10, true},
{"halt-time", 0, 10, 1, 11, true},
}

Expand Down

0 comments on commit 934905b

Please sign in to comment.