From aca254e0aed94be7cba0210b4a80bde161c2a169 Mon Sep 17 00:00:00 2001 From: ezreal1997 Date: Fri, 23 Aug 2024 00:15:34 +0800 Subject: [PATCH] fix(partial-withdrawal): update nextValIndex when skipping sweep --- client/x/evmstaking/keeper/withdraw.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/x/evmstaking/keeper/withdraw.go b/client/x/evmstaking/keeper/withdraw.go index 5cfe9265..30c8e241 100644 --- a/client/x/evmstaking/keeper/withdraw.go +++ b/client/x/evmstaking/keeper/withdraw.go @@ -69,7 +69,8 @@ func (k Keeper) ExpectedPartialWithdrawals(ctx context.Context) ([]estypes.Withd break } if validatorSet[nextValIndex].IsJailed() { - continue + // NOTE: always remember to update the `nextValIndex` when you skip for some reasons. + nextValIndex = (nextValIndex + 1) % int64(len(validatorSet)) } // Get validator's address. valBz, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(validatorSet[nextValIndex].GetOperator())