diff options
author | Jared Pereira <jared@otlw.co> | 2017-03-08 11:42:16 +0800 |
---|---|---|
committer | Jared Pereira <jared@otlw.co> | 2017-03-08 11:42:16 +0800 |
commit | 4916331c530896bbcef13a71a8f6dc0164b43c01 (patch) | |
tree | f6c294ccf52455a83a80c42b57b6e390db0d6e33 | |
parent | de44cd9ba46e562471d64e6cfc56cf8518f45113 (diff) | |
download | tangerine-wallet-browser-4916331c530896bbcef13a71a8f6dc0164b43c01.tar.gz tangerine-wallet-browser-4916331c530896bbcef13a71a8f6dc0164b43c01.tar.zst tangerine-wallet-browser-4916331c530896bbcef13a71a8f6dc0164b43c01.zip |
change BN.mul to BN.muln
-rw-r--r-- | app/scripts/lib/tx-utils.js | 2 | ||||
-rw-r--r-- | test/unit/tx-utils-test.js | 16 |
2 files changed, 8 insertions, 10 deletions
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js index 15cbb5b68..f5051eb8f 100644 --- a/app/scripts/lib/tx-utils.js +++ b/app/scripts/lib/tx-utils.js @@ -71,7 +71,7 @@ module.exports = class txProviderUtils { addGasBuffer (gas, blockGasLimitHex) { const blockGasLimitBn = new BN(ethUtil.stripHexPrefix(blockGasLimitHex), 16) const bnGas = new BN(ethUtil.stripHexPrefix(gas), 16) - const bufferedGas = bnGas.mul(1.5) + const bufferedGas = bnGas.muln(1.5) if (bnGas.gt(blockGasLimitBn)) return gas if (bufferedGas.lt(blockGasLimitBn)) return ethUtil.addHexPrefix(bufferedGas.toString(16)) diff --git a/test/unit/tx-utils-test.js b/test/unit/tx-utils-test.js index a7f2094c4..65233e1d9 100644 --- a/test/unit/tx-utils-test.js +++ b/test/unit/tx-utils-test.js @@ -13,16 +13,14 @@ describe('txUtils', function() { }) describe('addGasBuffer', function() { - describe('multiplies by 1.5', function() { - it('over a value', function() { - const input = '0x123fad' - const output = txUtils.addGasBuffer(input, '0x3d4c52') //0x3d4c52 is 4mil for dummy gas limit + it('multiplies by 1.5', function() { + const input = '0x123fad' + const output = txUtils.addGasBuffer(input, '0x3d4c52') //0x3d4c52 is 4mil for dummy gas limit - const inputBn = new BN(input, 'hex') - const outputBn = new BN(output, 'hex') - const expectedBn = inputBn.mul(1.5) - assert(outputBn.eq(expectedBn), 'returns 1.5 the input value') - }) + const inputBn = new BN(ethUtil.stripHexPrefix(input), 'hex') + const outputBn = new BN(ethUtil.stripHexPrefix(output), 'hex') + const expectedBn = inputBn.muln(1.5) + assert(outputBn.eq(expectedBn), 'returns 1.5 the input value') }) }) }) |