Skip to content
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

Adding private sendTx function #2257

Merged
merged 18 commits into from
Sep 23, 2022
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6148d88
chore: adding private sendTx function
chatton Sep 9, 2022
034c333
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 9, 2022
b4ff848
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 9, 2022
b9cf6af
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 9, 2022
f995875
chore: handling merge conflicts
chatton Sep 9, 2022
ded1071
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 13, 2022
11a6e20
chore: merge main
chatton Sep 13, 2022
e8093af
Merge branch 'cian/issue#2239-make-a-private-function-for-sendtx' of …
chatton Sep 13, 2022
7d204f2
chore: fix whitespace
chatton Sep 13, 2022
ef21792
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 15, 2022
a406332
chore: addressing PR feedback
chatton Sep 20, 2022
c005ad6
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 20, 2022
702f3cc
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 20, 2022
f72b5a2
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 21, 2022
f0717e3
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 21, 2022
2458341
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 21, 2022
134acec
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 22, 2022
78e38d4
Merge branch 'main' into cian/issue#2239-make-a-private-function-for-…
chatton Sep 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -50,7 +50,8 @@ func (s msgServer) SendTx(goCtx context.Context, msg *types.MsgSendTx) (*types.M
}

// explicitly passing nil as the argument is discarded as the channel capability is retrieved in SendTx.
seq, err := s.Keeper.SendTx(ctx, nil, msg.ConnectionId, portID, msg.PacketData, msg.TimeoutTimestamp)
absoluteTimeout := uint64(ctx.BlockTime().UnixNano()) + msg.TimeoutTimestamp
seq, err := s.Keeper.SendTx(ctx, nil, msg.ConnectionId, portID, msg.PacketData, absoluteTimeout)
if err != nil {
return nil, err
}
Original file line number Diff line number Diff line change
@@ -17,6 +17,10 @@ import (
// absolute timeoutTimestamp must be provided. If the packet is timed out, the channel will be closed.
// In the case of channel closure, a new channel may be reopened to reconnect to the host chain.
func (k Keeper) SendTx(ctx sdk.Context, _ *capabilitytypes.Capability, connectionID, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) {
return k.sendTx(ctx, connectionID, portID, icaPacketData, timeoutTimestamp)
}

func (k Keeper) sendTx(ctx sdk.Context, connectionID, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) {
activeChannelID, found := k.GetOpenActiveChannel(ctx, connectionID, portID)
if !found {
return 0, sdkerrors.Wrapf(icatypes.ErrActiveChannelNotFound, "failed to retrieve active channel on connection %s for port %s", connectionID, portID)