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

Merge pull request #4871 from MetaMask/3519-new-contract-gas

tx-gas-utils -  catch all errors from gas estimation
This commit is contained in:
Frankie 2018-07-25 15:33:17 -10:00 committed by GitHub
commit b5e3aafe2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,14 +30,10 @@ class TxGasUtil {
try { try {
estimatedGasHex = await this.estimateTxGas(txMeta, block.gasLimit) estimatedGasHex = await this.estimateTxGas(txMeta, block.gasLimit)
} catch (err) { } catch (err) {
const simulationFailed = ( txMeta.simulationFails = {
err.message.includes('Transaction execution error.') || reason: err.message,
err.message.includes('gas required exceeds allowance or always failing transaction')
)
if (simulationFailed) {
txMeta.simulationFails = true
return txMeta
} }
return txMeta
} }
this.setTxGas(txMeta, block.gasLimit, estimatedGasHex) this.setTxGas(txMeta, block.gasLimit, estimatedGasHex)
return txMeta return txMeta