aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-06-16 05:08:07 +0800
committerGitHub <noreply@github.com>2017-06-16 05:08:07 +0800
commit27b874f2c48fd1cb9dc0984646cb739173ddaf2c (patch)
treef4e5e63e3d3760a5ab69d69297e04614b5c146ff /app/scripts
parenta10740af7e35aa60e0445598403e6bda22382c2f (diff)
downloadtangerine-wallet-browser-27b874f2c48fd1cb9dc0984646cb739173ddaf2c.tar
tangerine-wallet-browser-27b874f2c48fd1cb9dc0984646cb739173ddaf2c.tar.gz
tangerine-wallet-browser-27b874f2c48fd1cb9dc0984646cb739173ddaf2c.tar.bz2
tangerine-wallet-browser-27b874f2c48fd1cb9dc0984646cb739173ddaf2c.tar.lz
tangerine-wallet-browser-27b874f2c48fd1cb9dc0984646cb739173ddaf2c.tar.xz
tangerine-wallet-browser-27b874f2c48fd1cb9dc0984646cb739173ddaf2c.tar.zst
tangerine-wallet-browser-27b874f2c48fd1cb9dc0984646cb739173ddaf2c.zip
transactions controller - add comments
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/controllers/transactions.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index 41f651458..aa168b736 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -26,6 +26,7 @@ module.exports = class TransactionController extends EventEmitter {
this.txProviderUtils = new TxProviderUtil(this.query)
this.blockTracker.on('block', this.checkForTxInBlock.bind(this))
this.blockTracker.on('block', this.resubmitPendingTxs.bind(this))
+ // provider-engine only exploses the 'block' event, not 'latest' for 'sync'
this.provider._blockTracker.on('sync', this.queryPendingTxs.bind(this))
this.signEthTx = opts.signTransaction
this.nonceLock = Semaphore(1)
@@ -371,10 +372,12 @@ module.exports = class TransactionController extends EventEmitter {
}
queryPendingTxs ({oldBlock, newBlock}) {
+ // check pending transactions on start
if (!oldBlock) {
this._checkPendingTxs()
return
}
+ // if we synced by more than one block, check for missed pending transactions
const diff = Number.parseInt(newBlock.number) - Number.parseInt(oldBlock.number)
if (diff > 1) this._checkPendingTxs()
}
@@ -453,6 +456,8 @@ module.exports = class TransactionController extends EventEmitter {
this.txProviderUtils.publishTransaction(rawTx, cb)
}
+ // checks the network for signed txs and
+ // if confirmed sets the tx status as 'confirmed'
_checkPendingTxs () {
var signedTxList = this.getFilteredTxList({status: 'submitted'})
if (!signedTxList.length) return