Skip to content

Commit

Permalink
Add hasInflightPackets. (#3836)
Browse files Browse the repository at this point in the history
* Add hasInflightPackets.

* update comment

* gofumpt

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
  • Loading branch information
DimitrisJim and crodriguezvega authored Jun 15, 2023
1 parent 87d8158 commit c769d22
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/core/04-channel/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,3 +570,14 @@ func (k Keeper) iterateHashes(ctx sdk.Context, iterator db.Iterator, cb func(por
}
}
}

// hasInflightPackets returns true if there are packet commitments stored at the specified
// port and channel, and false otherwise.
//
//lint:ignore U1000 Ignore unused function temporarily for debugging
func (k Keeper) hasInflightPackets(ctx sdk.Context, portID, channelID string) bool {
iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), []byte(host.PacketCommitmentPrefixPath(portID, channelID)))
defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() })

return iterator.Valid()
}

0 comments on commit c769d22

Please sign in to comment.