Skip to content

Commit 2681351

Browse files
authored
fix: if connection open check is added (#665)
1 parent acf4f94 commit 2681351

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

contracts/javascore/ibc/src/main/java/ibc/ics04/channel/IBCChannelHandshake.java

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public String _channelOpenInit(MsgChannelOpenInit msg) {
2626
byte[] connectionPb = connections.get(channel.getConnectionHops().get(0));
2727
Context.require(connectionPb != null, "connection does not exist");
2828
ConnectionEnd connection = ConnectionEnd.decode(connectionPb);
29+
Context.require(connection.getState() == ConnectionEnd.State.STATE_OPEN,
30+
"connection state is not OPEN");
2931

3032
Context.require(
3133
connection.getVersions().size() == 1,
@@ -54,6 +56,8 @@ public String _channelOpenTry(MsgChannelOpenTry msg) {
5456
byte[] connectionPb = connections.get(channel.getConnectionHops().get(0));
5557
Context.require(connectionPb != null, "connection does not exist");
5658
ConnectionEnd connection = ConnectionEnd.decode(connectionPb);
59+
Context.require(connection.getState() == ConnectionEnd.State.STATE_OPEN,
60+
"connection state is not OPEN");
5761

5862
Context.require(
5963
connection.getVersions().size() == 1,

0 commit comments

Comments
 (0)