Skip to content

Commit

Permalink
add inline comment for why state modifications in channelClosing happ…
Browse files Browse the repository at this point in the history
…en even on dapp revert
  • Loading branch information
RnkSngh committed May 7, 2024
1 parent 95c47c2 commit 022ff23
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contracts/core/Dispatcher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,9 @@ 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[msg.sender][channelId];

if (success) {
emit ChannelCloseInit(msg.sender, channelId);
} else {
Expand Down Expand Up @@ -440,6 +441,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 channelCloseInit)
delete _portChannelMap[portAddress][channelId];
if (success) {
emit ChannelCloseConfirm(portAddress, channelId);
Expand Down

0 comments on commit 022ff23

Please sign in to comment.