Skip to content

Commit

Permalink
fix(x/evmstaking): skip jailed validator in sweep logic (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdubpark authored Aug 22, 2024
1 parent a4ec4ed commit 91b7086
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client/x/evmstaking/keeper/withdraw.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ func (k Keeper) ExpectedPartialWithdrawals(ctx context.Context) ([]estypes.Withd
if swept > sweepBound {
break
}

if validatorSet[nextValIndex].IsJailed() {
// NOTE: always remember to update the `nextValIndex` when you skip for some reasons.
// nextValIndex should be updated, even if the validator is jailed, to progress to the sweep.
nextValIndex = (nextValIndex + 1) % int64(len(validatorSet))
continue
}

// Get validator's address.
valBz, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(validatorSet[nextValIndex].GetOperator())
if err != nil {
Expand Down

0 comments on commit 91b7086

Please sign in to comment.