From 1896928562c728612caa7498ed82559a82a09aeb Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 7 Nov 2016 11:55:17 -0800 Subject: 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. --- app/scripts/lib/idStore.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'app') 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 -- cgit