Skip to content

Commit

Permalink
Check completed otxs in SubmitEthereumTxConfirmation handler
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrit committed Feb 20, 2024
1 parent 1f3506f commit a9e2276
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions module/x/gravity/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,16 @@ func (k msgServer) SubmitEthereumTxConfirmation(c context.Context, msg *types.Ms
return nil, err
}

otx := k.GetOutgoingTx(ctx, confirmation.GetStoreIndex())
if otx == nil {
k.Logger(ctx).Error(
"no outgoing tx",
"store index", fmt.Sprintf("%x", confirmation.GetStoreIndex()),
)
return nil, sdkerrors.Wrap(types.ErrInvalid, "couldn't find outgoing tx")
var otx types.OutgoingTx
if otx = k.GetOutgoingTx(ctx, confirmation.GetStoreIndex()); otx == nil {
if otx = k.GetCompletedOutgoingTx(ctx, confirmation.GetStoreIndex()); otx == nil {
k.Logger(ctx).Error(
"no outgoing tx",
"store index", fmt.Sprintf("%x", confirmation.GetStoreIndex()),
)

return nil, sdkerrors.Wrap(types.ErrInvalid, "couldn't find outgoing tx")
}
}

gravityID := k.getGravityID(ctx)
Expand Down

0 comments on commit a9e2276

Please sign in to comment.