According to this and this answer any remaining gas after a require
statements assert
condition fails is returned/refunded back to msg.sender
but what about any ETHER sent in that transaction call i.e. msg.value
? Is that also refunded/returned back to the user?
1 Answer
Transfering ETH (which is done by setting msg.value
) is a state change. When your transaction reverts any state change is also reverted. This means the value "stays" in the original wallet.
As you mentioned the only change that is done to the blockchain is the fee payment.
Note: If an internal transaction reverts, it doesn't mean that the whole Ethereum transaction reverted. The value transfer will only undone if the (internal) transaction related to that transfer is reverted.