首页 文章

Contract 被杀但收到以太

提问于
浏览
0

我对功能 selfdestruct 的可靠性表示怀疑 . 我有以下 Contract :

pragma solidity ^0.4.25;

 contract TestMetamask {

 string public name = "Joao";
 event EtherReceived();

 function changeName(string _name) public {
    name = _name;
 }

 function() public payable {
    emit EtherReceived();
 }

 function receiveEther() payable public {
    address(this).transfer(msg.value);
 }

 function balance() public view returns (uint256) {
    return address(this).balance;
 }

 function kill() public {
    selfdestruct(msg.sender);
 }
}

所以这个 Contract 有效,但是当我执行函数kill()时,合约继续在应付函数 receiveEther 中接收以太 . 另一个函数不起作用,状态变量是干净的,问题是只有 Contract 破坏接收以太 .

这是rinkeby Contract 的地址:https://rinkeby.etherscan.io/address/0xe0491e86b972ae4b0f8359a6066b79256ea01274

有谁有同样的情况?

韩国社交协会 .

1 回答

相关问题