Skip to content

Commit

Permalink
Ensure state checks are done
Browse files Browse the repository at this point in the history
  • Loading branch information
lebascou committed Mar 6, 2024
1 parent 4abf0a9 commit 3db66fc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions x/millions/keeper/keeper_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ func (k Keeper) RebalanceValidatorsBondings(ctx sdk.Context, poolID uint64) erro
}

// Make sure pool is ready
if pool.State == types.PoolState_Created || pool.State == types.PoolState_Unspecified {
if pool.State != types.PoolState_Ready && pool.State != types.PoolState_Paused {
return types.ErrPoolNotReady
}

Expand All @@ -633,7 +633,7 @@ func (k Keeper) RedelegateToActiveValidatorsOnRemoteZone(ctx sdk.Context, poolID
}

// Make sure pool is ready
if pool.State == types.PoolState_Created || pool.State == types.PoolState_Unspecified {
if pool.State != types.PoolState_Ready && pool.State != types.PoolState_Paused {
return types.ErrPoolNotReady
}

Expand Down Expand Up @@ -685,7 +685,7 @@ func (k Keeper) OnRedelegateToActiveValidatorsOnRemoteZoneCompleted(ctx sdk.Cont
}

// Make sure pool is ready
if pool.State == types.PoolState_Created || pool.State == types.PoolState_Unspecified {
if pool.State != types.PoolState_Ready && pool.State != types.PoolState_Paused {
return types.ErrPoolNotReady
}

Expand Down
2 changes: 2 additions & 0 deletions x/millions/keeper/keeper_prize.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ func (k Keeper) ClawBackPrize(ctx sdk.Context, poolID uint64, drawID uint64, pri
// If the pool is in closing or closed state, we do not process any prize clawback
// We want all user to be able to claim their prize, no matter the state
if pool.State == types.PoolState_Closing || pool.State == types.PoolState_Closed {
// Since clawback is triggered by a queue we simulate a successful clawback and the queue will never retry it
// = infinite prize claim duration
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion x/millions/keeper/msg_server_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (k msgServer) RestoreInterchainAccounts(goCtx context.Context, msg *types.M
}

// We always want our pool to be ready
if pool.State == types.PoolState_Created {
if pool.State == types.PoolState_Created || pool.State == types.PoolState_Unspecified {
return nil, types.ErrPoolNotReady
}

Expand Down

0 comments on commit 3db66fc

Please sign in to comment.