1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Handle a negative gas fee (#13511)

This commit is contained in:
Daniel 2022-02-07 11:58:31 +01:00 committed by GitHub
parent 405a3495b0
commit 1297761de7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,10 +51,12 @@ function calculateGasEstimateWithRefund(
estimatedRefund,
10,
);
const isMaxGasMinusRefundNegative = maxGasMinusRefund.lt(0);
const gasEstimateWithRefund = maxGasMinusRefund.lt(estimatedGas, 16)
? maxGasMinusRefund.toString(16)
: estimatedGas;
const gasEstimateWithRefund =
!isMaxGasMinusRefundNegative && maxGasMinusRefund.lt(estimatedGas, 16)
? maxGasMinusRefund.toString(16)
: estimatedGas;
return gasEstimateWithRefund;
}