aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/index.js
diff options
context:
space:
mode:
authorThomas <thomas.b.huang@gmail.com>2018-05-08 22:11:29 +0800
committerThomas <thomas.b.huang@gmail.com>2018-05-08 22:11:29 +0800
commit6c9b303dbd37b0ccad98d05a7b88824bf65de542 (patch)
treebf581bb3e98ed5a98ec85248e976a357d3bde58e /app/scripts/controllers/transactions/index.js
parentf7a3d8887cf7e6fd198e3143825f0f8a50765376 (diff)
parentcaf5a6c15c3375d9d64116d80d87eb064e955e59 (diff)
downloadtangerine-wallet-browser-6c9b303dbd37b0ccad98d05a7b88824bf65de542.tar.gz
tangerine-wallet-browser-6c9b303dbd37b0ccad98d05a7b88824bf65de542.tar.zst
tangerine-wallet-browser-6c9b303dbd37b0ccad98d05a7b88824bf65de542.zip
Merge branch 'develop' into e2e-tests
Diffstat (limited to 'app/scripts/controllers/transactions/index.js')
-rw-r--r--app/scripts/controllers/transactions/index.js15
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..a1588cfef 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} weather 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