fix timeout bug (#8200)

This commit is contained in:
colin axnér 2020-12-18 20:01:01 +01:00 committed by GitHub
parent 4e7c5e9291
commit 25bb17db8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -170,7 +170,7 @@ func (k Keeper) GetPacketReceipt(ctx sdk.Context, portID, channelID string, sequ
// SetPacketReceipt sets an empty packet receipt to the store // SetPacketReceipt sets an empty packet receipt to the store
func (k Keeper) SetPacketReceipt(ctx sdk.Context, portID, channelID string, sequence uint64) { func (k Keeper) SetPacketReceipt(ctx sdk.Context, portID, channelID string, sequence uint64) {
store := ctx.KVStore(k.storeKey) store := ctx.KVStore(k.storeKey)
store.Set(host.PacketReceiptKey(portID, channelID, sequence), []byte("")) store.Set(host.PacketReceiptKey(portID, channelID, sequence), []byte{byte(1)})
} }
// GetPacketCommitment gets the packet commitment hash from the store // GetPacketCommitment gets the packet commitment hash from the store

View File

@ -166,12 +166,13 @@ func (suite KeeperTestSuite) TestGetAllPacketState() {
ack3 := types.NewPacketState(channelA1.PortID, channelA1.ID, 1, []byte("ack")) ack3 := types.NewPacketState(channelA1.PortID, channelA1.ID, 1, []byte("ack"))
// create channel 0 receipts // create channel 0 receipts
rec1 := types.NewPacketState(channelA0.PortID, channelA0.ID, 1, []byte("")) receipt := string([]byte{byte(1)})
rec2 := types.NewPacketState(channelA0.PortID, channelA0.ID, 2, []byte("")) rec1 := types.NewPacketState(channelA0.PortID, channelA0.ID, 1, []byte(receipt))
rec2 := types.NewPacketState(channelA0.PortID, channelA0.ID, 2, []byte(receipt))
// channel 1 receipts // channel 1 receipts
rec3 := types.NewPacketState(channelA1.PortID, channelA1.ID, 1, []byte("")) rec3 := types.NewPacketState(channelA1.PortID, channelA1.ID, 1, []byte(receipt))
rec4 := types.NewPacketState(channelA1.PortID, channelA1.ID, 2, []byte("")) rec4 := types.NewPacketState(channelA1.PortID, channelA1.ID, 2, []byte(receipt))
// channel 0 packet commitments // channel 0 packet commitments
comm1 := types.NewPacketState(channelA0.PortID, channelA0.ID, 1, []byte("hash")) comm1 := types.NewPacketState(channelA0.PortID, channelA0.ID, 1, []byte("hash"))

View File

@ -381,7 +381,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() {
} else { } else {
suite.Require().Equal(uint64(1), nextSeqRecv, "sequence incremented for UNORDERED channel") suite.Require().Equal(uint64(1), nextSeqRecv, "sequence incremented for UNORDERED channel")
suite.Require().True(receiptStored, "packet receipt not stored after RecvPacket in UNORDERED channel") suite.Require().True(receiptStored, "packet receipt not stored after RecvPacket in UNORDERED channel")
suite.Require().Equal("", receipt, "packet receipt is not empty string") suite.Require().Equal(string([]byte{byte(1)}), receipt, "packet receipt is not empty string")
} }
} else { } else {
suite.Require().Error(err) suite.Require().Error(err)