diff options
author | kumavis <aaron@kumavis.me> | 2018-05-17 02:57:07 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2018-05-17 02:57:07 +0800 |
commit | c27d9162d7001fa2bd6cfb98dd110716951d2d1b (patch) | |
tree | 19f5d4780b3ee82c0e9c9fe2a9c2edad745dd084 /app/scripts/controllers/transactions/index.js | |
parent | a1d13d45cf7451162b071e5507f1e31b12574e6e (diff) | |
parent | 6e79225dbff512ab9bcae2731bcfc4ce33e98664 (diff) | |
download | tangerine-wallet-browser-c27d9162d7001fa2bd6cfb98dd110716951d2d1b.tar.gz tangerine-wallet-browser-c27d9162d7001fa2bd6cfb98dd110716951d2d1b.tar.zst tangerine-wallet-browser-c27d9162d7001fa2bd6cfb98dd110716951d2d1b.zip |
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-controller-remove-setNetworkEndpoints
Diffstat (limited to 'app/scripts/controllers/transactions/index.js')
-rw-r--r-- | app/scripts/controllers/transactions/index.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 541f1db73..3886db104 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -112,6 +112,21 @@ class TransactionController extends EventEmitter { } /** + Check if a txMeta in the list with the same nonce has been confirmed in a block + if the txParams dont have a nonce will return false + @returns {boolean} whether the nonce has been used in a transaction confirmed in a block + @param {object} txMeta - the txMeta object + */ + async isNonceTaken (txMeta) { + const { from, nonce } = txMeta.txParams + if ('nonce' in txMeta.txParams) { + const sameNonceTxList = this.txStateManager.getFilteredTxList({from, nonce, status: 'confirmed'}) + return (sameNonceTxList.length >= 1) + } + return false + } + + /** add a new unapproved transaction to the pipeline @returns {Promise<string>} the hash of the transaction after being submitted to the network |