aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDan Finlay <flyswatter@users.noreply.github.com>2017-06-13 01:30:25 +0800
committerGitHub <noreply@github.com>2017-06-13 01:30:25 +0800
commit2e6e6e41250011b451412608e455fe6402634729 (patch)
tree7e84df2522037578f6761854f8316d0484d4b8a0 /app
parentcd3362f941b8eae12adbb6ffe9d60d4a6195755f (diff)
parent3e1d648ec012af9a8fe6fc3b329338f7f7fc80e2 (diff)
downloadtangerine-wallet-browser-2e6e6e41250011b451412608e455fe6402634729.tar.gz
tangerine-wallet-browser-2e6e6e41250011b451412608e455fe6402634729.tar.zst
tangerine-wallet-browser-2e6e6e41250011b451412608e455fe6402634729.zip
Merge pull request #1535 from MetaMask/gasupdater
Update GasBlockLimits on every new block
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/eth-store.js2
-rw-r--r--app/scripts/lib/tx-utils.js9
2 files changed, 2 insertions, 9 deletions
diff --git a/app/scripts/lib/eth-store.js b/app/scripts/lib/eth-store.js
index 6f04a9dd6..ebba98f5c 100644
--- a/app/scripts/lib/eth-store.js
+++ b/app/scripts/lib/eth-store.js
@@ -21,6 +21,7 @@ class EthereumStore extends ObservableStore {
transactions: {},
currentBlockNumber: '0',
currentBlockHash: '',
+ currentBlockGasLimit: '',
})
this._provider = opts.provider
this._query = new EthQuery(this._provider)
@@ -73,6 +74,7 @@ class EthereumStore extends ObservableStore {
this._currentBlockNumber = blockNumber
this.updateState({ currentBlockNumber: parseInt(blockNumber) })
this.updateState({ currentBlockHash: `0x${block.hash.toString('hex')}`})
+ this.updateState({ currentBlockGasLimit: `0x${block.gasLimit.toString('hex')}` })
async.parallel([
this._updateAccounts.bind(this),
this._updateTransactions.bind(this, blockNumber),
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js
index 658f3bedc..149d93102 100644
--- a/app/scripts/lib/tx-utils.js
+++ b/app/scripts/lib/tx-utils.js
@@ -21,21 +21,12 @@ module.exports = class txProviderUtils {
this.query.getBlockByNumber('latest', true, (err, block) => {
if (err) return cb(err)
async.waterfall([
- self.setBlockGasLimit.bind(self, txMeta, block.gasLimit),
self.estimateTxGas.bind(self, txMeta, block.gasLimit),
self.setTxGas.bind(self, txMeta, block.gasLimit),
], cb)
})
}
- setBlockGasLimit (txMeta, blockGasLimitHex, cb) {
- const blockGasLimitBN = hexToBn(blockGasLimitHex)
- const saferGasLimitBN = BnMultiplyByFraction(blockGasLimitBN, 19, 20)
- txMeta.blockGasLimit = bnToHex(saferGasLimitBN)
- cb()
- return
- }
-
estimateTxGas (txMeta, blockGasLimitHex, cb) {
const txParams = txMeta.txParams
// check if gasLimit is already specified