diff options
author | kumavis <kumavis@users.noreply.github.com> | 2016-11-11 14:01:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-11 14:01:06 +0800 |
commit | e123e3095b97fbec9ffa9ba966b0c24bd8c97723 (patch) | |
tree | 15abbc62f59b4f4b96b8f46c49714243bb696d02 | |
parent | ad290d3edca99daa22d595a26e63ac6dff480d9d (diff) | |
parent | f88079c6b9c0e7bf5d7765f8ea8471b64624d8d0 (diff) | |
download | tangerine-wallet-browser-e123e3095b97fbec9ffa9ba966b0c24bd8c97723.tar tangerine-wallet-browser-e123e3095b97fbec9ffa9ba966b0c24bd8c97723.tar.gz tangerine-wallet-browser-e123e3095b97fbec9ffa9ba966b0c24bd8c97723.tar.bz2 tangerine-wallet-browser-e123e3095b97fbec9ffa9ba966b0c24bd8c97723.tar.lz tangerine-wallet-browser-e123e3095b97fbec9ffa9ba966b0c24bd8c97723.tar.xz tangerine-wallet-browser-e123e3095b97fbec9ffa9ba966b0c24bd8c97723.tar.zst tangerine-wallet-browser-e123e3095b97fbec9ffa9ba966b0c24bd8c97723.zip |
Merge branch 'master' into i328-MultiVault
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | app/scripts/lib/idStore.js | 18 | ||||
-rw-r--r-- | ui/app/components/pending-tx.js | 9 |
3 files changed, 26 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index d0dbb5706..d7da7df7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Current Master +- Show a warning when a transaction fails during simulation. - Fix bug where 20% of gas estimate was not being added properly. ## 2.13.7 2016-11-8 diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 23b14524e..390c8a8ab 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -257,10 +257,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() }) } diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 4c27a8092..b619020d1 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -30,6 +30,15 @@ PendingTx.prototype.render = function () { } `), + txData.simulationFails ? + h('span.error', { + style: { + marginLeft: 50, + fontSize: '0.9em', + }, + }, 'Transaction Error. Exception thrown in contract code.') + : null, + state.insufficientBalance ? h('span.error', { style: { |