diff options
author | kumavis <aaron@kumavis.me> | 2017-08-23 05:04:31 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2017-08-23 05:04:31 +0800 |
commit | e43da3e4aa703cf49543df7726b8cbeea987943d (patch) | |
tree | 31a31e00de8631a87d38aa5a876f707f906f3c19 | |
parent | b191649ef5ee952c636b224658181fdf2fd73b97 (diff) | |
download | tangerine-wallet-browser-e43da3e4aa703cf49543df7726b8cbeea987943d.tar.gz tangerine-wallet-browser-e43da3e4aa703cf49543df7726b8cbeea987943d.tar.zst tangerine-wallet-browser-e43da3e4aa703cf49543df7726b8cbeea987943d.zip |
nonce-tracker - simplify getHighestNonce
-rw-r--r-- | app/scripts/lib/nonce-tracker.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/app/scripts/lib/nonce-tracker.js b/app/scripts/lib/nonce-tracker.js index d44f9c858..dab6ace1f 100644 --- a/app/scripts/lib/nonce-tracker.js +++ b/app/scripts/lib/nonce-tracker.js @@ -139,11 +139,9 @@ class NonceTracker { } _getHighestNonce (txList) { - const nonces = txList.map((txMeta) => txMeta.txParams.nonce) - const nonceHex = nonces.reduce((highestNonce, nonce) => { - return parseInt(nonce, 16) > parseInt(highestNonce, 16) ? nonce : highestNonce - }, '0x0') - return parseInt(nonceHex, 16) + const nonces = txList.map((txMeta) => parseInt(txMeta.txParams.nonce, 16)) + const highestNonce = Math.max.apply(null, nonces) + return highestNonce } // this is a hotfix for the fact that the blockTracker will |