From 259d19850fd0692b1abfffe77bccaec2ee828eea Mon Sep 17 00:00:00 2001 From: Thomas Huang Date: Thu, 2 Jul 2020 12:58:12 -0700 Subject: [PATCH] Account for a custom nonce of zero (#8883) * Account for a custom nonce of zero * Remove default value for customNonceValue --- app/scripts/controllers/transactions/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 43e13b77a..344f9a972 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -443,14 +443,14 @@ export default class TransactionController extends EventEmitter { const txMeta = this.txStateManager.getTx(txId) const fromAddress = txMeta.txParams.from // wait for a nonce - let { customNonceValue = null } = txMeta + let { customNonceValue } = txMeta customNonceValue = Number(customNonceValue) nonceLock = await this.nonceTracker.getNonceLock(fromAddress) // add nonce to txParams // if txMeta has lastGasPrice then it is a retry at same nonce with higher // gas price transaction and their for the nonce should not be calculated const nonce = txMeta.lastGasPrice ? txMeta.txParams.nonce : nonceLock.nextNonce - const customOrNonce = customNonceValue || nonce + const customOrNonce = (customNonceValue === 0) ? customNonceValue : customNonceValue || nonce txMeta.txParams.nonce = ethUtil.addHexPrefix(customOrNonce.toString(16)) // add nonce debugging information to txMeta