Skip to content

Commit

Permalink
Alter connection handshake (cosmos#6209)
Browse files Browse the repository at this point in the history
* Alter connection handshake

* Add test-case

Co-authored-by: Federico Kunze <[email protected]>
  • Loading branch information
cwgoes and fedekunze authored May 13, 2020
1 parent 6d7fc91 commit 513c5f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions x/ibc/03-connection/keeper/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ func (k Keeper) ConnOpenAck(
return sdkerrors.Wrap(types.ErrConnectionNotFound, "cannot relay ACK of open attempt")
}

// Check connection on ChainA is on correct state: INIT
if connection.State != ibctypes.INIT {
// Check connection on ChainA is on correct state: INIT or TRYOPEN
if connection.State != ibctypes.INIT && connection.State != ibctypes.TRYOPEN {
return sdkerrors.Wrapf(
types.ErrInvalidConnectionState,
"connection state is not INIT (got %s)", connection.State.String(),
Expand Down
9 changes: 9 additions & 0 deletions x/ibc/03-connection/keeper/handshake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
suite.chainA.updateClient(suite.chainB)
return suite.chainB.Header.GetHeight()
}, true},
{"success from tryopen", version, func() uint64 {
suite.chainA.CreateClient(suite.chainB)
suite.chainB.CreateClient(suite.chainA)
suite.chainB.createConnection(testConnectionIDB, testConnectionIDA, testClientIDA, testClientIDB, ibctypes.TRYOPEN)
suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDB, testClientIDA, ibctypes.TRYOPEN)
suite.chainB.updateClient(suite.chainA)
suite.chainA.updateClient(suite.chainB)
return suite.chainB.Header.GetHeight()
}, true},
{"consensus height > latest height", version, func() uint64 {
return 10
}, false},
Expand Down

0 comments on commit 513c5f3

Please sign in to comment.