diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2019-07-19 11:37:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-19 11:37:51 +0800 |
commit | aea54d1b86e8b3d23afe145428335bffdbfe906c (patch) | |
tree | b44b904952fa4621faa2dbba4b9d6058275401d3 /app/scripts/controllers/transactions | |
parent | 2a7278eb7eb4c1895c5beebda2a0ea1e80bc4037 (diff) | |
download | tangerine-wallet-browser-aea54d1b86e8b3d23afe145428335bffdbfe906c.tar.gz tangerine-wallet-browser-aea54d1b86e8b3d23afe145428335bffdbfe906c.tar.zst tangerine-wallet-browser-aea54d1b86e8b3d23afe145428335bffdbfe906c.zip |
Address resubmit bug (#6886)
* Add some notes
* Add explanatory comment and TODO
* Typo
* Improve verbage
* Remove contextual comment
Diffstat (limited to 'app/scripts/controllers/transactions')
-rw-r--r-- | app/scripts/controllers/transactions/index.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 1ae925835..c4371c25b 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -68,6 +68,7 @@ class TransactionController extends EventEmitter { this.blockTracker = opts.blockTracker this.signEthTx = opts.signTransaction this.getGasPrice = opts.getGasPrice + this.inProcessOfSigning = new Set() this.memStore = new ObservableStore({}) this.query = new EthQuery(this.provider) @@ -354,6 +355,15 @@ class TransactionController extends EventEmitter { @param txId {number} - the tx's Id */ async approveTransaction (txId) { + // TODO: Move this safety out of this function. + // Since this transaction is async, + // we need to keep track of what is currently being signed, + // So that we do not increment nonce + resubmit something + // that is already being incrmented & signed. + if (this.inProcessOfSigning.has(txId)) { + return + } + this.inProcessOfSigning.add(txId) let nonceLock try { // approve @@ -387,6 +397,8 @@ class TransactionController extends EventEmitter { if (nonceLock) nonceLock.releaseLock() // continue with error chain throw err + } finally { + this.inProcessOfSigning.delete(txId) } } /** |