We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Noticed in an audit that we've got this pattern
gaia/app/export.go
Lines 165 to 184 in 08ff244
Put that code into a closure and add a defer iter.Close() then call the closure immediately so
iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) counter := int16(0) func() { // Closure to ensure iterator doesn't leak. defer iter.Close() for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) validator, found := app.StakingKeeper.GetValidator(ctx, addr) if !found { panic("expected validator, not found") } validator.UnbondingHeight = 0 if applyAllowedAddrs && !allowedAddrsMap[addr.String()] { validator.Jailed = true } app.StakingKeeper.SetValidator(ctx, validator) counter++ } }()
/cc @elias-orijtech
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Summary of Bug
Noticed in an audit that we've got this pattern
gaia/app/export.go
Lines 165 to 184 in 08ff244
Suggestion
Put that code into a closure and add a defer iter.Close() then call the closure immediately so
/cc @elias-orijtech
For Admin Use
The text was updated successfully, but these errors were encountered: