Skip to content

Commit

Permalink
Merge pull request #877 from crypto-com/fix/ibc-transfer-hanlder
Browse files Browse the repository at this point in the history
FIX: Missing empty write_acknowledgement handler on MsgTransfer parser
  • Loading branch information
davcrypto authored Feb 29, 2024
2 parents 480e189 + 34fb3a0 commit 23a779e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions usecase/parser/v0_42_7/ibcmsg/ibcmsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,22 @@ func ParseMsgTransfer(
}
}

var packetAck ibc_model.MsgRecvPacketPacketAck
writeAckEvents := log.GetEventsByType("write_acknowledgement")
if writeAckEvents == nil {
parserParams.Logger.Warnf("missing `write_acknowledgement` event in TxsResult log on TxHash: %s", parserParams.MsgCommonParams.TxHash)
}
var writeAckEventPacketAck string
for _, writeAckEvent := range writeAckEvents {
if writeAckEvent.HasAttribute("packet_ack") {
writeAckEventPacketAck = writeAckEvent.MustGetAttributeByKey("packet_ack")
} else {
var writeAckEventPacketAck string
for _, writeAckEvent := range writeAckEvents {
if writeAckEvent.HasAttribute("packet_ack") {
writeAckEventPacketAck = writeAckEvent.MustGetAttributeByKey("packet_ack")
}
}

if writeAckEventPacketAck != "" {
json.MustUnmarshalFromString(writeAckEventPacketAck, &packetAck)
}
}
var packetAck ibc_model.MsgRecvPacketPacketAck
json.MustUnmarshalFromString(writeAckEventPacketAck, &packetAck)

msgRecvPacketParams := ibc_model.MsgRecvPacketParams{
RawMsgRecvPacket: rawMsg,
Expand Down

0 comments on commit 23a779e

Please sign in to comment.