I am with a doubt about the function selfdestruct in solidity. I have this contract below:
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);
}
}
So this contract works, but when I execute the function kill() the contract keeps getting receiving ether in the function payable receiveEther. The another functions doesn't works and the state variables are clean, the problem is only with the contract destructed receive ether.
This is the address of the contract at rinkeby: https://rinkeby.etherscan.io/address/0xe0491e86b972ae4b0f8359a6066b79256ea01274
Does anyone has been the same situation?
tks.