aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvicnaum <vicnaum@gmail.com>2017-12-07 22:30:05 +0800
committerGitHub <noreply@github.com>2017-12-07 22:30:05 +0800
commit553d713636d317b74d819d62b5b931bdf2d112d8 (patch)
tree45d4d3f22cb75470ad5bef6400e99507bfc200d6
parent7854321faeeb8184b3171e3b214f57d6e61c0814 (diff)
downloadtangerine-wallet-browser-553d713636d317b74d819d62b5b931bdf2d112d8.tar
tangerine-wallet-browser-553d713636d317b74d819d62b5b931bdf2d112d8.tar.gz
tangerine-wallet-browser-553d713636d317b74d819d62b5b931bdf2d112d8.tar.bz2
tangerine-wallet-browser-553d713636d317b74d819d62b5b931bdf2d112d8.tar.lz
tangerine-wallet-browser-553d713636d317b74d819d62b5b931bdf2d112d8.tar.xz
tangerine-wallet-browser-553d713636d317b74d819d62b5b931bdf2d112d8.tar.zst
tangerine-wallet-browser-553d713636d317b74d819d62b5b931bdf2d112d8.zip
A more expressive way
replaced ifs with ? :
-rw-r--r--app/scripts/controllers/transactions.js7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index 060484b87..6bdbd2cfc 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -201,11 +201,8 @@ module.exports = class TransactionController extends EventEmitter {
// wait for a nonce
nonceLock = await this.nonceTracker.getNonceLock(fromAddress)
// add nonce to txParams
- if (txMeta.nonceSpecified) {
- txMeta.txParams.nonce = ethUtil.addHexPrefix(txMeta.txParams.nonce.toString(16))
- } else {
- txMeta.txParams.nonce = ethUtil.addHexPrefix(nonceLock.nextNonce.toString(16))
- }
+ const nonce = txMeta.nonceSpecified ? txMeta.txParams.nonce : nonceLock.nextNonce
+ txMeta.txParams.nonce = ethUtil.addHexPrefix(nonce.toString(16))
// add nonce debugging information to txMeta
txMeta.nonceDetails = nonceLock.nonceDetails
this.txStateManager.updateTx(txMeta, 'transactions#approveTransaction')