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

fix(query): get next send sequence for transfer packets #4706

Merged
merged 9 commits into from
Sep 19, 2023
18 changes: 7 additions & 11 deletions modules/core/04-channel/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,25 +555,21 @@ func (k Keeper) NextSequenceSend(c context.Context, req *types.QueryNextSequence

ctx := sdk.UnwrapSDKContext(c)

channel, found := k.GetChannel(ctx, req.PortId, req.ChannelId)
_, found := k.GetChannel(ctx, req.PortId, req.ChannelId)
if !found {
return nil, status.Error(
codes.NotFound,
errorsmod.Wrapf(types.ErrChannelNotFound, "port-id: %s, channel-id %s", req.PortId, req.ChannelId).Error(),
)
}
dzmitry-lahoda marked this conversation as resolved.
Show resolved Hide resolved

// Return the next sequence send for ordered channels. Unordered channels
// do not make use of the next sequence send.
var sequence uint64
if channel.Ordering != types.UNORDERED {
sequence, found = k.GetNextSequenceSend(ctx, req.PortId, req.ChannelId)
if !found {
return nil, status.Error(
codes.NotFound,
errorsmod.Wrapf(types.ErrSequenceSendNotFound, "port-id: %s, channel-id %s", req.PortId, req.ChannelId).Error(),
)
}
sequence, found = k.GetNextSequenceSend(ctx, req.PortId, req.ChannelId)
if !found {
return nil, status.Error(
codes.NotFound,
errorsmod.Wrapf(types.ErrSequenceSendNotFound, "port-id: %s, channel-id %s", req.PortId, req.ChannelId).Error(),
)
}
selfHeight := clienttypes.GetSelfHeight(ctx)
return types.NewQueryNextSequenceSendResponse(sequence, nil, selfHeight), nil
Expand Down
Loading