Commit e3525cde authored by Nicolas Lara's avatar Nicolas Lara
Browse files

fix the way acks are being handled. ibc-go's ack.Success() doesn't work (even...

fix the way acks are being handled. ibc-go's ack.Success() doesn't work (even if the unmarshaling succeeds and there is a non-error result)
parent 0870cf38
Showing with 9 additions and 1 deletion
+9 -1
......@@ -144,6 +144,14 @@ func (im *IBCModule) OnRecvPacket(
return im.app.OnRecvPacket(ctx, packet, relayer)
}
func isAckError(acknowledgement []byte) bool {
var ackErr channeltypes.Acknowledgement_Error
if err := json.Unmarshal(acknowledgement, &ackErr); err == nil && len(ackErr.Error) > 0 {
return true
}
return false
}
// OnAcknowledgementPacket implements the IBCModule interface
func (im *IBCModule) OnAcknowledgementPacket(
ctx sdk.Context,
......@@ -156,7 +164,7 @@ func (im *IBCModule) OnAcknowledgementPacket(
return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal ICS-20 transfer packet acknowledgement: %v", err)
}
if !ack.Success() {
if isAckError(acknowledgement) {
err := im.RevertSentPacket(ctx, packet) // If there is an error here we should still handle the ack
if err != nil {
ctx.EventManager().EmitEvent(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment