aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2017-03-30 21:25:28 +0800
committerGitHub <noreply@github.com>2017-03-30 21:25:28 +0800
commit9a6b84644ab459ed113596f034350768e30ad06b (patch)
tree69a1973484067fc00f89a20c6877a1f03b620068 /app
parent467035075e0f8fdd0cf66dd668ad619cafc2105a (diff)
parent16b5f4a210cd496b9160efbfa5e2cc44ae0c8f5c (diff)
downloadtangerine-wallet-browser-9a6b84644ab459ed113596f034350768e30ad06b.tar
tangerine-wallet-browser-9a6b84644ab459ed113596f034350768e30ad06b.tar.gz
tangerine-wallet-browser-9a6b84644ab459ed113596f034350768e30ad06b.tar.bz2
tangerine-wallet-browser-9a6b84644ab459ed113596f034350768e30ad06b.tar.lz
tangerine-wallet-browser-9a6b84644ab459ed113596f034350768e30ad06b.tar.xz
tangerine-wallet-browser-9a6b84644ab459ed113596f034350768e30ad06b.tar.zst
tangerine-wallet-browser-9a6b84644ab459ed113596f034350768e30ad06b.zip
Merge pull request #1293 from MetaMask/ImproveGasEstimates
tx-utils - gas buffer ceiling at 90% of block gas limit
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/tx-utils.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js
index 72df53631..e8e23f8b5 100644
--- a/app/scripts/lib/tx-utils.js
+++ b/app/scripts/lib/tx-utils.js
@@ -63,14 +63,15 @@ module.exports = class txProviderUtils {
addGasBuffer (initialGasLimitHex, blockGasLimitHex) {
const initialGasLimitBn = hexToBn(initialGasLimitHex)
const blockGasLimitBn = hexToBn(blockGasLimitHex)
+ const upperGasLimitBn = blockGasLimitBn.muln(0.9)
const bufferedGasLimitBn = initialGasLimitBn.muln(1.5)
// if initialGasLimit is above blockGasLimit, dont modify it
- if (initialGasLimitBn.gt(blockGasLimitBn)) return bnToHex(initialGasLimitBn)
+ if (initialGasLimitBn.gt(upperGasLimitBn)) return bnToHex(initialGasLimitBn)
// if bufferedGasLimit is below blockGasLimit, use bufferedGasLimit
- if (bufferedGasLimitBn.lt(blockGasLimitBn)) return bnToHex(bufferedGasLimitBn)
+ if (bufferedGasLimitBn.lt(upperGasLimitBn)) return bnToHex(bufferedGasLimitBn)
// otherwise use blockGasLimit
- return bnToHex(blockGasLimitBn)
+ return bnToHex(upperGasLimitBn)
}
fillInTxParams (txParams, cb) {