aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorvicnaum <vicnaum@gmail.com>2017-12-07 05:49:24 +0800
committerGitHub <noreply@github.com>2017-12-07 05:49:24 +0800
commit7854321faeeb8184b3171e3b214f57d6e61c0814 (patch)
tree111bcf5075f3fd0ff810e2e8337d7971a421e2cf /app
parenta78cc013d199547ba865a0d1c2fec9a328ce7e0b (diff)
downloadtangerine-wallet-browser-7854321faeeb8184b3171e3b214f57d6e61c0814.tar.gz
tangerine-wallet-browser-7854321faeeb8184b3171e3b214f57d6e61c0814.tar.zst
tangerine-wallet-browser-7854321faeeb8184b3171e3b214f57d6e61c0814.zip
Fix for #2644 - Specified Nonce isn't used
Added nonceSpecified. And a check if nonce was specified - then we should use the specified nonce instead of generating a new one.
Diffstat (limited to 'app')
-rw-r--r--app/scripts/controllers/transactions.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index ce709bd28..060484b87 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -177,6 +177,7 @@ module.exports = class TransactionController extends EventEmitter {
const txParams = txMeta.txParams
// ensure value
txMeta.gasPriceSpecified = Boolean(txParams.gasPrice)
+ txMeta.nonceSpecified = Boolean(txParams.nonce)
const gasPrice = txParams.gasPrice || await this.query.gasPrice()
txParams.gasPrice = ethUtil.addHexPrefix(gasPrice.toString(16))
txParams.value = txParams.value || '0x0'
@@ -200,7 +201,11 @@ module.exports = class TransactionController extends EventEmitter {
// wait for a nonce
nonceLock = await this.nonceTracker.getNonceLock(fromAddress)
// add nonce to txParams
- txMeta.txParams.nonce = ethUtil.addHexPrefix(nonceLock.nextNonce.toString(16))
+ if (txMeta.nonceSpecified) {
+ txMeta.txParams.nonce = ethUtil.addHexPrefix(txMeta.txParams.nonce.toString(16))
+ } else {
+ txMeta.txParams.nonce = ethUtil.addHexPrefix(nonceLock.nextNonce.toString(16))
+ }
// add nonce debugging information to txMeta
txMeta.nonceDetails = nonceLock.nonceDetails
this.txStateManager.updateTx(txMeta, 'transactions#approveTransaction')