From 98eb0b7cd6e4dc2e3ec1f4b07d08d8c5add4037f Mon Sep 17 00:00:00 2001 From: cool-developer <51834436+cool-develope@users.noreply.github.com> Date: Thu, 19 Sep 2024 17:05:04 -0400 Subject: [PATCH] fix(staking): avoid the double iterator close in staking (#21823) --- x/staking/keeper/cons_pubkey.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x/staking/keeper/cons_pubkey.go b/x/staking/keeper/cons_pubkey.go index e1938597fa7c..d60d4628b959 100644 --- a/x/staking/keeper/cons_pubkey.go +++ b/x/staking/keeper/cons_pubkey.go @@ -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) }