diff options
author | Kevin Serrano <kevin.serrano@consensys.net> | 2017-06-03 06:18:14 +0800 |
---|---|---|
committer | Kevin Serrano <kevin.serrano@consensys.net> | 2017-06-03 06:18:14 +0800 |
commit | 2b7d8424981fbbd0f6306b5ee7abf8754f9f7092 (patch) | |
tree | 3947f5acf75e8560a837d083373011c3444a6e38 /ui/app/components | |
parent | 9eea990425f1f68eabca8b283bdfc662befcd226 (diff) | |
download | tangerine-wallet-browser-2b7d8424981fbbd0f6306b5ee7abf8754f9f7092.tar tangerine-wallet-browser-2b7d8424981fbbd0f6306b5ee7abf8754f9f7092.tar.gz tangerine-wallet-browser-2b7d8424981fbbd0f6306b5ee7abf8754f9f7092.tar.bz2 tangerine-wallet-browser-2b7d8424981fbbd0f6306b5ee7abf8754f9f7092.tar.lz tangerine-wallet-browser-2b7d8424981fbbd0f6306b5ee7abf8754f9f7092.tar.xz tangerine-wallet-browser-2b7d8424981fbbd0f6306b5ee7abf8754f9f7092.tar.zst tangerine-wallet-browser-2b7d8424981fbbd0f6306b5ee7abf8754f9f7092.zip |
Update gasblocklimit params with every block.
Diffstat (limited to 'ui/app/components')
-rw-r--r-- | ui/app/components/pending-tx.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index b46f715bc..0847a8d4c 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -32,7 +32,7 @@ function PendingTx () { PendingTx.prototype.render = function () { const props = this.props - const { currentCurrency } = props + const { currentCurrency, blockGasLimit } = props const conversionRate = props.conversionRate const txMeta = this.gatherTxMeta() @@ -47,7 +47,8 @@ PendingTx.prototype.render = function () { // Gas const gas = txParams.gas const gasBn = hexToBn(gas) - const safeGasLimit = parseInt(txMeta.blockGasLimit) + const gasLimit = new BN(parseInt(blockGasLimit)) + const safeGasLimit = this.bnMultiplyByFraction(gasLimit, 19, 20).toString(10) // Gas Price const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16) @@ -434,6 +435,12 @@ PendingTx.prototype._notZeroOrEmptyString = function (obj) { return obj !== '' && obj !== '0x0' } +PendingTx.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) { + const numBN = new BN(numerator) + const denomBN = new BN(denominator) + return targetBN.mul(numBN).div(denomBN) +} + function forwardCarrat () { return ( h('img', { |