Skip to content

Commit 935de3a

Browse files
mergify[bot]ulbqb
authored andcommitted
Save gas on IsFeeEnabled (backport cosmos#2786) (cosmos#2815)
improvements: save some gas in fee keeper
1 parent 66d293a commit 935de3a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
4444

4545
### Improvements
4646

47+
* (apps/29-fee) [\#2786](https://github.com/cosmos/ibc-go/pull/2786) Save gas by checking key existence with `KVStore`'s `Has` method.
48+
4749
### Features
4850

4951
### Bug Fixes

modules/apps/29-fee/keeper/keeper.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (k Keeper) DeleteFeeEnabled(ctx sdk.Context, portID, channelID string) {
121121
// fee enabled flag for the given port and channel identifiers
122122
func (k Keeper) IsFeeEnabled(ctx sdk.Context, portID, channelID string) bool {
123123
store := ctx.KVStore(k.storeKey)
124-
return store.Get(types.KeyFeeEnabled(portID, channelID)) != nil
124+
return store.Has(types.KeyFeeEnabled(portID, channelID))
125125
}
126126

127127
// GetAllFeeEnabledChannels returns a list of all ics29 enabled channels containing portID & channelID that are stored in state

0 commit comments

Comments
 (0)