fix(staking): avoid the double iterator close in staking (backport #21823) (#21824)

Co-authored-by: cool-developer <51834436+cool-develope@users.noreply.github.com>
This commit is contained in:
mergify[bot] 2024-09-20 00:38:13 +02:00 committed by GitHub
parent a1e7ef0446
commit 6bda2aa061
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -258,8 +258,7 @@ func (k Keeper) GetBlockConsPubKeyRotationHistory(ctx context.Context) ([]types.
if err != nil {
return nil, err
}
defer iterator.Close()
// iterator would be closed in the CollectValues
return indexes.CollectValues(ctx, k.RotationHistory, iterator)
}