A more expressive way

replaced ifs with ? :
feature/default_network_editable
vicnaum 7 years ago committed by GitHub
parent 7854321fae
commit 553d713636
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      app/scripts/controllers/transactions.js

@ -201,11 +201,8 @@ module.exports = class TransactionController extends EventEmitter {
// wait for a nonce // wait for a nonce
nonceLock = await this.nonceTracker.getNonceLock(fromAddress) nonceLock = await this.nonceTracker.getNonceLock(fromAddress)
// add nonce to txParams // add nonce to txParams
if (txMeta.nonceSpecified) { const nonce = txMeta.nonceSpecified ? txMeta.txParams.nonce : nonceLock.nextNonce
txMeta.txParams.nonce = ethUtil.addHexPrefix(txMeta.txParams.nonce.toString(16)) txMeta.txParams.nonce = ethUtil.addHexPrefix(nonce.toString(16))
} else {
txMeta.txParams.nonce = ethUtil.addHexPrefix(nonceLock.nextNonce.toString(16))
}
// add nonce debugging information to txMeta // add nonce debugging information to txMeta
txMeta.nonceDetails = nonceLock.nonceDetails txMeta.nonceDetails = nonceLock.nonceDetails
this.txStateManager.updateTx(txMeta, 'transactions#approveTransaction') this.txStateManager.updateTx(txMeta, 'transactions#approveTransaction')

Loading…
Cancel
Save