aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-03-30 14:21:31 +0800
committerkumavis <aaron@kumavis.me>2017-03-30 14:21:31 +0800
commitff49e5e5cf3aadf63dbdf6570407c23e1ae6cdb9 (patch)
tree4e4748a5ff2ef9b5b2cb6a76bbe94c6a9e98c7a0 /app/scripts
parent5d38792910147dfcc00028a2f8b262a47cab295f (diff)
downloadtangerine-wallet-browser-ff49e5e5cf3aadf63dbdf6570407c23e1ae6cdb9.tar
tangerine-wallet-browser-ff49e5e5cf3aadf63dbdf6570407c23e1ae6cdb9.tar.gz
tangerine-wallet-browser-ff49e5e5cf3aadf63dbdf6570407c23e1ae6cdb9.tar.bz2
tangerine-wallet-browser-ff49e5e5cf3aadf63dbdf6570407c23e1ae6cdb9.tar.lz
tangerine-wallet-browser-ff49e5e5cf3aadf63dbdf6570407c23e1ae6cdb9.tar.xz
tangerine-wallet-browser-ff49e5e5cf3aadf63dbdf6570407c23e1ae6cdb9.tar.zst
tangerine-wallet-browser-ff49e5e5cf3aadf63dbdf6570407c23e1ae6cdb9.zip
tx-utils - gas buffer ceiling at 90% of block gas limit
Diffstat (limited to 'app/scripts')
-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) {