Skip to content

Commit

Permalink
x/staking: add call to iterator Close() method (#6794)
Browse files Browse the repository at this point in the history
Original pull request: #6791
  • Loading branch information
Alessio Treglia committed Jul 20, 2020
1 parent 04267dd commit e42c50c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (client) [\#5585](https://github.com/cosmos/cosmos-sdk/pull/5585) `CLIContext` additions:
* Introduce `QueryABCI` that returns the full `abci.ResponseQuery` with inclusion Merkle proofs.
* Added `prove` flag for Merkle proof verification.
* (x/staking) [\#6791)](https://github.com/cosmos/cosmos-sdk/pull/6791) Close {UBDQueue,RedelegationQueu}Iterator once used.

### API Breaking Changes

Expand Down
4 changes: 4 additions & 0 deletions x/staking/keeper/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context,
store := ctx.KVStore(k.storeKey)
// gets an iterator for all timeslices from time 0 until the current Blockheader time
unbondingTimesliceIterator := k.UBDQueueIterator(ctx, ctx.BlockHeader().Time)
defer unbondingTimesliceIterator.Close()

for ; unbondingTimesliceIterator.Valid(); unbondingTimesliceIterator.Next() {
timeslice := []types.DVPair{}
value := unbondingTimesliceIterator.Value()
Expand Down Expand Up @@ -445,6 +447,8 @@ func (k Keeper) DequeueAllMatureRedelegationQueue(ctx sdk.Context, currTime time
store := ctx.KVStore(k.storeKey)
// gets an iterator for all timeslices from time 0 until the current Blockheader time
redelegationTimesliceIterator := k.RedelegationQueueIterator(ctx, ctx.BlockHeader().Time)
defer redelegationTimesliceIterator.Close()

for ; redelegationTimesliceIterator.Valid(); redelegationTimesliceIterator.Next() {
timeslice := []types.DVVTriplet{}
value := redelegationTimesliceIterator.Value()
Expand Down

0 comments on commit e42c50c

Please sign in to comment.