You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not closing the KVStore iterate after use, e.g. in x/staking/keeper/validator.go
func (kKeeper) GetAllMatureValidatorQueue(ctx sdk.Context, currTime time.Time) (matureValsAddrs []sdk.ValAddress) {
// gets an iterator for all timeslices from time 0 until the current Blockheader timevalidatorTimesliceIterator:=k.ValidatorQueueIterator(ctx, ctx.BlockHeader().Time)
for ; validatorTimesliceIterator.Valid(); validatorTimesliceIterator.Next() {
timeslice:= []sdk.ValAddress{}
k.cdc.MustUnmarshalBinaryLengthPrefixed(validatorTimesliceIterator.Value(), ×lice)
matureValsAddrs=append(matureValsAddrs, timeslice...)
}
returnmatureValsAddrs
}
// Unbonds all the unbonding validators that have finished their unbonding periodfunc (kKeeper) UnbondAllMatureValidatorQueue(ctx sdk.Context) {
store:=ctx.KVStore(k.storeKey)
validatorTimesliceIterator:=k.ValidatorQueueIterator(ctx, ctx.BlockHeader().Time)
for ; validatorTimesliceIterator.Valid(); validatorTimesliceIterator.Next() {
timeslice:= []sdk.ValAddress{}
k.cdc.MustUnmarshalBinaryLengthPrefixed(validatorTimesliceIterator.Value(), ×lice)
for_, valAddr:=rangetimeslice {
val, found:=k.GetValidator(ctx, valAddr)
if!found {
panic("validator in the unbonding queue was not found")
}
ifval.GetStatus() !=sdk.Unbonding {
panic("unexpected validator in unbonding queue, status was not unbonding")
}
k.unbondingToUnbonded(ctx, val)
ifval.GetDelegatorShares().IsZero() {
k.RemoveValidator(ctx, val.OperatorAddress)
}
}
store.Delete(validatorTimesliceIterator.Key())
}
}
validatorTimesliceIterator, validatorTimesliceIterator must be closed before methods return
Summary of Bug
Not closing the KVStore iterate after use, e.g. in x/staking/keeper/validator.go
validatorTimesliceIterator, validatorTimesliceIterator
must be closed before methods returnVersion
latest
5f92fef
Steps to Reproduce
For Admin Use
The text was updated successfully, but these errors were encountered: