Skip to content

Commit

Permalink
fix closing iterator in 07-tendermint
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan committed Jan 17, 2023
1 parent 8f0cfb0 commit 140b79e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/light-clients/07-tendermint/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func IterateConsensusMetadata(store sdk.KVStore, cb func(key, val []byte) bool)
iterator := sdk.KVStorePrefixIterator(store, []byte(host.KeyConsensusStatePrefix))

// iterate over processed time and processed height
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
keySplit := strings.Split(string(iterator.Key()), "/")
// processed time key in prefix store has format: "consensusState/<height>/processedTime"
Expand All @@ -99,6 +98,8 @@ func IterateConsensusMetadata(store sdk.KVStore, cb func(key, val []byte) bool)
}
}

iterator.Close()

// iterate over iteration keys
iterator = sdk.KVStorePrefixIterator(store, []byte(KeyIterateConsensusStatePrefix))

Expand Down

0 comments on commit 140b79e

Please sign in to comment.