Skip to content

Commit

Permalink
apply patch to prevent an attack on home
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Storm committed Jul 18, 2018
1 parent aa811e7 commit 2db543f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion contracts/upgradeable_contracts/U_HomeBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import "../libraries/Message.sol";
import "./U_BasicBridge.sol";
import "../upgradeability/EternalStorage.sol";

contract Sacrifice {
constructor(address _recipient) public payable {
selfdestruct(_recipient);
}
}

contract HomeBridge is EternalStorage, BasicBridge {
using SafeMath for uint256;
Expand Down Expand Up @@ -81,7 +86,9 @@ contract HomeBridge is EternalStorage, BasicBridge {
setWithdraws(txHash, true);

// pay out recipient
recipient.transfer(amount);
if (!recipient.send(amount)) {
(new Sacrifice).value(amount)(recipient);
}

emit Withdraw(recipient, amount, txHash);
}
Expand Down

0 comments on commit 2db543f

Please sign in to comment.