-
Notifications
You must be signed in to change notification settings - Fork 597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: no longer removing active channel mapping on close channel #730
Changes from 2 commits
baa5d9d
3ac112e
c467787
1fdaa3f
5f28a1f
b40f329
ba5cafa
38c05d9
7161674
edd267a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,6 +14,7 @@ import ( | |||||
|
||||||
"github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" | ||||||
icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" | ||||||
channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" | ||||||
host "github.com/cosmos/ibc-go/v3/modules/core/24-host" | ||||||
) | ||||||
|
||||||
|
@@ -101,7 +102,7 @@ func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability | |||||
return k.scopedKeeper.ClaimCapability(ctx, cap, name) | ||||||
} | ||||||
|
||||||
// GetActiveChannelID retrieves the active channelID from the store keyed by the provided portID | ||||||
// GetActiveChannelID retrieves the active channelID from the store key by the provided portID | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Think this comment should stay the same, but probably add a comma so it reads correctly.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, I've updated in in two places. |
||||||
func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool) { | ||||||
store := ctx.KVStore(k.storeKey) | ||||||
key := icatypes.KeyActiveChannel(portID) | ||||||
|
@@ -113,6 +114,21 @@ func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool | |||||
return string(store.Get(key)), true | ||||||
} | ||||||
|
||||||
// HasActiveChannel retrieves the active channelID from the store key by the provided portID & checks if the channel in question is in state OPEN | ||||||
func (k Keeper) HasActiveChannel(ctx sdk.Context, portID string) (string, bool) { | ||||||
crodriguezvega marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
store := ctx.KVStore(k.storeKey) | ||||||
key := icatypes.KeyActiveChannel(portID) | ||||||
|
||||||
channelID := string(store.Get(key)) | ||||||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
channel, found := k.channelKeeper.GetChannel(ctx, portID, channelID) | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
just a suggestion |
||||||
if channel.State == channeltypes.OPEN && found { | ||||||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
return channelID, true | ||||||
} | ||||||
|
||||||
return "", false | ||||||
} | ||||||
|
||||||
// GetAllActiveChannels returns a list of all active interchain accounts controller channels and their associated port identifiers | ||||||
func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []icatypes.ActiveChannel { | ||||||
store := ctx.KVStore(k.storeKey) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use the
TestVersion
variable hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea