diff --git a/contracts/core/Dispatcher.sol b/contracts/core/Dispatcher.sol index d8913815..a5f26e9d 100644 --- a/contracts/core/Dispatcher.sol +++ b/contracts/core/Dispatcher.sol @@ -373,7 +373,9 @@ contract Dispatcher is OwnableUpgradeable, UUPSUpgradeable, ReentrancyGuard, IDi ) ); - delete _portChannelMap[msg.sender][channelId]; + delete _portChannelMap[msg.sender][channelId]; // Note: We delete the portChannelMap here even on Dapp revert to + // avoid having a case where a dapp deployed with a faulty callback cannot close a channel (as is done on + // ChannelCloseInit) if (success) { emit ChannelCloseInit(msg.sender, channelId); } else { @@ -429,6 +431,8 @@ contract Dispatcher is OwnableUpgradeable, UUPSUpgradeable, ReentrancyGuard, IDi ) ); + // Note: We delete the portChannelMap here even on Dapp revert to avoid having a case where a dapp deployed with + // a faulty callback cannot close a channel (as is done on channelCloseConfirm) delete _portChannelMap[portAddress][channelId]; if (success) { emit ChannelCloseConfirm(portAddress, channelId);