Skip to content

Commit

Permalink
fix first_block_voted post upgrade check
Browse files Browse the repository at this point in the history
  • Loading branch information
tschuyebuhl committed Feb 28, 2025
1 parent 38068b7 commit 15ae333
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/pkg/daemon/checks/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,17 @@ func CheckBlockSignedBy(address bytes.HexBytes, height int64, consensusState jso
if err := json.Unmarshal(consensusState, &rs); err != nil {
return InvalidBlockState, errors.Wrapf(err, "Error in parsing consensus state: %v, will retry")
}

parts := strings.Split(rs.HeightRoundStep, "/")
currentHeight, err := strconv.ParseInt(parts[0], 10, 64)
if err != nil {
return InvalidBlockState, errors.Wrapf(err, "Error in parsing height from consensus state")
}

if currentHeight > height {
// when the chain halts at height N, the height returned in consensus state should be N+1
// because the _next_ block is being voted on
// so we should return BlockSkipped only if the state goes further than that
if currentHeight > height+1 {
return BlockSkipped, nil
}

Expand Down

0 comments on commit 15ae333

Please sign in to comment.