Skip to content

Commit

Permalink
Add constructor for MsgAcknowledgement
Browse files Browse the repository at this point in the history
  • Loading branch information
bznein committed Sep 19, 2024
1 parent 9d0ff03 commit a004929
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 11 additions & 0 deletions modules/core/04-channel/v2/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,14 @@ func NewMsgRecvPacket(packet v1types.PacketV2, proofCommitment []byte, proofHeig
Signer: signer,
}
}

// NewMsgAcknowledgement constructs and returns a new MsgAcknowledgement
func NewMsgAcknoweldgement(packet v1types.PacketV2, multiAck v1types.MultiAcknowledgement, proofAcked []byte, proofHeight clienttypes.Height, signer string) *MsgAcknowledgement {
return &MsgAcknowledgement{
Packet: packet,
MultiAcknowledgement: multiAck,
ProofAcked: proofAcked,
ProofHeight: proofHeight,
Signer: signer,
}
}
8 changes: 1 addition & 7 deletions modules/core/keeper/msg_server_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,7 @@ func (suite *KeeperTestSuite) TestMsgServerV2PacketFlow() {
packetKey = host.PacketAcknowledgementKey(host.SentinelV2PortID, packet.DestinationId, packet.GetSequence())
proof, proofHeight = path.EndpointB.QueryProof(packetKey)

msgAck := &channeltypesv2.MsgAcknowledgement{
Packet: packet,
MultiAcknowledgement: expectedAck,
ProofAcked: proof,
ProofHeight: proofHeight,
Signer: suite.chainA.SenderAccount.GetAddress().String(),
}
msgAck := channeltypesv2.NewMsgAcknoweldgement(packet, expectedAck, proof, proofHeight, suite.chainA.SenderAccount.GetAddress().String())

ackPacketResponse, err := path.EndpointA.Chain.SendMsgs(msgAck)
suite.Require().NoError(path.EndpointB.UpdateClient())
Expand Down

0 comments on commit a004929

Please sign in to comment.