1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

nonce-tracker - simplify getHighestNonce

This commit is contained in:
kumavis 2017-08-22 14:04:31 -07:00
parent b191649ef5
commit e43da3e4aa

View File

@ -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