Skip to content

Commit

Permalink
Merge pull request #3 from open-ibc/thomas/fix-delete-on-close
Browse files Browse the repository at this point in the history
fix connectedchannels on close deletion issue
  • Loading branch information
tmsdkeys authored Feb 14, 2024
2 parents 2bd02bd + 26a5bdb commit 653c11a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions contracts/CustomChanIbcContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract CustomChanIbcContract is IbcReceiverBase, IbcReceiver {
function updateDispatcher(IbcDispatcher _dispatcher) external onlyOwner {
dispatcher = _dispatcher;
}

/**
* @dev Sends a packet with a greeting message over a specified channel.
* @param message The greeting message to be sent.
Expand Down Expand Up @@ -160,7 +160,10 @@ contract CustomChanIbcContract is IbcReceiverBase, IbcReceiver {
bool channelFound = false;
for (uint256 i = 0; i < connectedChannels.length; i++) {
if (connectedChannels[i].channelId == channelId) {
delete connectedChannels[i];
for (uint256 j = i; j < connectedChannels.length - 1; j++) {
connectedChannels[j] = connectedChannels[j + 1];
}
connectedChannels.pop();
channelFound = true;
break;
}
Expand Down

0 comments on commit 653c11a

Please sign in to comment.