aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/idStore.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-11-11 13:37:09 +0800
committerGitHub <noreply@github.com>2016-11-11 13:37:09 +0800
commitf88079c6b9c0e7bf5d7765f8ea8471b64624d8d0 (patch)
treeed4164447d8a06ba9120d00ac2091eb66521bbda /app/scripts/lib/idStore.js
parent3775a4bf799efc99cfe3d46b35fc0b39a82c94c2 (diff)
parent1d0abc47711fd93f99289f9c59a58fb4fa2d1587 (diff)
downloadtangerine-wallet-browser-f88079c6b9c0e7bf5d7765f8ea8471b64624d8d0.tar
tangerine-wallet-browser-f88079c6b9c0e7bf5d7765f8ea8471b64624d8d0.tar.gz
tangerine-wallet-browser-f88079c6b9c0e7bf5d7765f8ea8471b64624d8d0.tar.bz2
tangerine-wallet-browser-f88079c6b9c0e7bf5d7765f8ea8471b64624d8d0.tar.lz
tangerine-wallet-browser-f88079c6b9c0e7bf5d7765f8ea8471b64624d8d0.tar.xz
tangerine-wallet-browser-f88079c6b9c0e7bf5d7765f8ea8471b64624d8d0.tar.zst
tangerine-wallet-browser-f88079c6b9c0e7bf5d7765f8ea8471b64624d8d0.zip
Merge pull request #805 from MetaMask/i804
detect tx error - show warning and fix gasLimit
Diffstat (limited to 'app/scripts/lib/idStore.js')
-rw-r--r--app/scripts/lib/idStore.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js
index dd895a6c0..cd717df28 100644
--- a/app/scripts/lib/idStore.js
+++ b/app/scripts/lib/idStore.js
@@ -259,10 +259,24 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone
}
function estimateGas(cb){
- query.estimateGas(txParams, function(err, result){
+ var estimationParams = extend(txParams)
+ // 1 billion gas for estimation
+ var gasLimit = '0x3b9aca00'
+ estimationParams.gas = gasLimit
+ query.estimateGas(estimationParams, function(err, result){
if (err) return cb(err)
+ if (result === estimationParams.gas) {
+ txData.simulationFails = true
+ query.getBlockByNumber('latest', true, function(err, block){
+ if (err) return cb(err)
+ txData.estimatedGas = block.gasLimit
+ txData.txParams.gas = block.gasLimit
+ cb()
+ })
+ return
+ }
txData.estimatedGas = self.addGasBuffer(result)
- txData.txParams.gasLimit = txData.estimatedGas
+ txData.txParams.gas = txData.estimatedGas
cb()
})
}