The presence of the payable modifier means that the function can process transactions with non-zero Ether value. If a transaction that transfers Ether comes to the contract and calls some function X, then if this function X does not have the payable modifier, then the transaction will be rejected.
The fallback function is designed to handle the situation when no function is called at all in a transaction comes to the contract (for example, the transaction simply transfers ether), or a function is called that is not in the contract. In this case, similar to the one described above - if the fallback function has the payable modifier, then it will be able to accept transactions with the transfer of Ether, if not, then they will be rejected.
Accordingly, in your case, if Ether is being transmitted in the transaction, the function somefunction will be called successfully, and when the receive function is called, the transaction will be rejected.
contract(){
receive() {
somefunction()
}
somefunction() payable external{
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…