diff options
author | kumavis <kumavis@users.noreply.github.com> | 2016-10-18 04:33:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-18 04:33:02 +0800 |
commit | 0f0951ba549c294222421ef8508294165e9b5fdd (patch) | |
tree | 1c14d688553014175c7fb4fe8c5e0f88048f0db5 /app/scripts/lib | |
parent | 101e839f9a254891d9c32a6b4660252506ead04c (diff) | |
parent | 827d7553fc843a75b7a4306c7549505f799609d7 (diff) | |
download | tangerine-wallet-browser-0f0951ba549c294222421ef8508294165e9b5fdd.tar tangerine-wallet-browser-0f0951ba549c294222421ef8508294165e9b5fdd.tar.gz tangerine-wallet-browser-0f0951ba549c294222421ef8508294165e9b5fdd.tar.bz2 tangerine-wallet-browser-0f0951ba549c294222421ef8508294165e9b5fdd.tar.lz tangerine-wallet-browser-0f0951ba549c294222421ef8508294165e9b5fdd.tar.xz tangerine-wallet-browser-0f0951ba549c294222421ef8508294165e9b5fdd.tar.zst tangerine-wallet-browser-0f0951ba549c294222421ef8508294165e9b5fdd.zip |
Merge pull request #744 from MetaMask/i738-IncreaseGas
Increase gas estimate by 100000 wei
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/idStore.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index aa77c3360..9d0ca7f19 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -2,6 +2,7 @@ const EventEmitter = require('events').EventEmitter const inherits = require('util').inherits const async = require('async') const ethUtil = require('ethereumjs-util') +const BN = ethUtil.BN const EthQuery = require('eth-query') const KeyStore = require('eth-lightwallet').keystore const clone = require('clone') @@ -266,7 +267,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone function estimateGas(cb){ query.estimateGas(txParams, function(err, result){ if (err) return cb(err) - txData.estimatedGas = result + txData.estimatedGas = self.addGasBuffer(result) cb() }) } @@ -281,6 +282,13 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone } } +IdentityStore.prototype.addGasBuffer = function (gasHex) { + var gas = new BN(gasHex, 16) + var buffer = new BN('100000', 10) + var result = gas.add(buffer) + return ethUtil.addHexPrefix(result.toString(16)) +} + // comes from metamask ui IdentityStore.prototype.approveTransaction = function (txId, cb) { const configManager = this.configManager |