diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-03-24 06:10:57 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-03-24 06:11:52 +0800 |
commit | 31c1839ed76c56c3e988d1f77957ae71f433836c (patch) | |
tree | 3fc35638eff37be356720270e9fc93c6943d4662 | |
parent | 612bace17d8fb84fd755a30f03fc9075b4d967f1 (diff) | |
download | tangerine-wallet-browser-31c1839ed76c56c3e988d1f77957ae71f433836c.tar tangerine-wallet-browser-31c1839ed76c56c3e988d1f77957ae71f433836c.tar.gz tangerine-wallet-browser-31c1839ed76c56c3e988d1f77957ae71f433836c.tar.bz2 tangerine-wallet-browser-31c1839ed76c56c3e988d1f77957ae71f433836c.tar.lz tangerine-wallet-browser-31c1839ed76c56c3e988d1f77957ae71f433836c.tar.xz tangerine-wallet-browser-31c1839ed76c56c3e988d1f77957ae71f433836c.tar.zst tangerine-wallet-browser-31c1839ed76c56c3e988d1f77957ae71f433836c.zip |
Fix initial gas price estimate
-rw-r--r-- | ui/app/components/pending-tx.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 6753fc098..c0786d83e 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -15,9 +15,6 @@ const addressSummary = util.addressSummary const nameForAddress = require('../../lib/contract-namer') const HexInput = require('./hex-as-decimal-input') -const DEFAULT_GAS_PRICE_BN = new BN(20000000000, '10') -const DEFAULT_GAS_PRICE = DEFAULT_GAS_PRICE_BN.toString(16) - const MIN_GAS_PRICE_BN = new BN(20000000) @@ -373,12 +370,16 @@ PendingTx.prototype.isValid = function () { } PendingTx.prototype.calculateGas = function () { + const state = this.state + const props = this.props + const txData = props.txData + const txMeta = this.gatherParams() log.debug(`pending-tx-details calculating gas for ${JSON.stringify(txMeta)}`) const txParams = txMeta.txParams const gasCost = new BN(ethUtil.stripHexPrefix(txParams.gas || txMeta.estimatedGas), 16) - const gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice || DEFAULT_GAS_PRICE), 16) + const gasPrice = (state.gasPrice === undefined) ? txData.gasPrice : state.gasPrice const valid = !gasPrice.lt(MIN_GAS_PRICE_BN) this.validChanged(valid) |