Refund even in failure

This commit is contained in:
derpy-duck 2023-02-21 22:29:51 +00:00
parent a1df44b3ee
commit 556b0dd572
1 changed files with 3 additions and 5 deletions

View File

@ -438,11 +438,9 @@ contract CoreRelayer is CoreRelayerGovernance {
: (preGas - postGas);
// refund unused gas budget
uint256 weiToRefund = internalInstruction.receiverValueTarget;
if (success) {
weiToRefund = (internalInstruction.executionParameters.gasLimit - gasUsed)
* internalInstruction.maximumRefundTarget / internalInstruction.executionParameters.gasLimit;
}
uint256 weiToRefund = (internalInstruction.executionParameters.gasLimit - gasUsed)
* internalInstruction.maximumRefundTarget / internalInstruction.executionParameters.gasLimit
+ (success ? 0 : internalInstruction.receiverValueTarget);
// unlock the contract
setContractLock(false);