I have a contract that needs to be able to receive Ether. The contract includes a receive function to receive Ether but I wonder if it's good practice to also have a fallback function in case someone doesn't call the receive function. So I would have:
receive() external payable {
emit Deposit(msg.sender,msg.value);
}
fallback() external payable {
// check data length 0 so only used for sending money to contract
require(msg.data.length == 0);
emit Deposit(msg.sender,msg.value);
}
or should my fallback function be something like the following so that the contract will only receive funds via the receive function:
fallback() external payable {
revert();
}