mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Enforce nonces as type string
This commit is contained in:
parent
a122ec1f8b
commit
c620123fab
@ -115,13 +115,21 @@ class NonceTracker {
|
||||
}
|
||||
|
||||
_getHighestNonce (txList) {
|
||||
const nonces = txList.map((txMeta) => parseInt(txMeta.txParams.nonce, 16))
|
||||
const nonces = txList.map((txMeta) => {
|
||||
const nonce = txMeta.txParams.nonce
|
||||
assert(typeof nonce, 'string', 'nonces should be hex strings')
|
||||
return parseInt(nonce, 16)
|
||||
})
|
||||
const highestNonce = Math.max.apply(null, nonces)
|
||||
return highestNonce
|
||||
}
|
||||
|
||||
_getHighestContinuousFrom (txList, startPoint) {
|
||||
const nonces = txList.map((txMeta) => parseInt(txMeta.txParams.nonce, 16))
|
||||
const nonces = txList.map((txMeta) => {
|
||||
const nonce = txMeta.txParams.nonce
|
||||
assert(typeof nonce, 'string', 'nonces should be hex strings')
|
||||
return parseInt(nonce, 16)
|
||||
})
|
||||
|
||||
let highest = startPoint
|
||||
while (nonces.includes(highest)) {
|
||||
|
Loading…
Reference in New Issue
Block a user