Alter connection handshake (#6209)

* Alter connection handshake

* Add test-case

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Christopher Goes 2020-05-13 19:26:19 +02:00 committed by GitHub
parent 6d7fc911c2
commit 513c5f30c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -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(),

View File

@ -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},