aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-11-08 03:55:17 +0800
committerDan Finlay <dan@danfinlay.com>2016-11-08 03:56:20 +0800
commit1896928562c728612caa7498ed82559a82a09aeb (patch)
treefb13533f7f937f88ed814566528c83584af6fa1c /app/scripts
parentfff5a6765ecc586bd855aa263c0fdfc3f957e8d7 (diff)
downloadtangerine-wallet-browser-1896928562c728612caa7498ed82559a82a09aeb.tar
tangerine-wallet-browser-1896928562c728612caa7498ed82559a82a09aeb.tar.gz
tangerine-wallet-browser-1896928562c728612caa7498ed82559a82a09aeb.tar.bz2
tangerine-wallet-browser-1896928562c728612caa7498ed82559a82a09aeb.tar.lz
tangerine-wallet-browser-1896928562c728612caa7498ed82559a82a09aeb.tar.xz
tangerine-wallet-browser-1896928562c728612caa7498ed82559a82a09aeb.tar.zst
tangerine-wallet-browser-1896928562c728612caa7498ed82559a82a09aeb.zip
Fix gas price buffering
Our gas price buffering logic had a bug, because bn.js has inconsistent behavior when using hex-prefixed output. The issue has been opened with them here: https://github.com/indutny/bn.js/issues/151 We've corrected our usage in the mean time.
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/lib/idStore.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js
index 46d53c4e1..1010a5789 100644
--- a/app/scripts/lib/idStore.js
+++ b/app/scripts/lib/idStore.js
@@ -287,11 +287,11 @@ IdentityStore.prototype.checkForDelegateCall = function (codeHex) {
}
}
-IdentityStore.prototype.addGasBuffer = function (gasHex) {
- var gas = new BN(gasHex, 16)
- var buffer = new BN('100000', 10)
- var result = gas.add(buffer)
- return ethUtil.addHexPrefix(result.toString(16))
+const gasBuffer = new BN('100000', 10)
+IdentityStore.prototype.addGasBuffer = function (gas) {
+ const bnGas = new BN(ethUtil.stripHexPrefix(gas), 16)
+ const correct = bnGas.add(gasBuffer)
+ return ethUtil.addHexPrefix(correct.toString(16))
}
// comes from metamask ui