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

Handle a negative gas fee (#13511)

This commit is contained in:
Daniel 2022-02-07 11:58:31 +01:00 committed by Dan Miller
parent a7eaf1bd7f
commit 9731e5fbeb

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;
}