This commit is contained in:
Josh Harvey 2016-11-27 17:06:46 +02:00
parent 493e669e6d
commit 3a99b7a6bc

View file

@ -257,8 +257,8 @@ function fiatBalance (settings, fiatCode, cryptoCode, deviceId) {
}) })
} }
function processTxStatus (tx) { function processTxStatus (settings, tx) {
return wallet.getStatus(tx.toAddress, tx.cryptoAtoms, tx.cryptoCode) return wallet.getStatus(settings, tx.toAddress, tx.cryptoAtoms, tx.cryptoCode)
.then(res => db.updateTxStatus(tx, res.status)) .then(res => db.updateTxStatus(tx, res.status))
} }
@ -279,16 +279,24 @@ function notifyConfirmation (tx) {
function monitorLiveIncoming () { function monitorLiveIncoming () {
const statuses = ['notSeen', 'published', 'insufficientFunds'] const statuses = ['notSeen', 'published', 'insufficientFunds']
db.fetchOpenTxs(statuses, STALE_LIVE_INCOMING_TX_AGE)
.then(txs => Promise.all(txs.map(processTxStatus))) return settingsLoader.settings()
.catch(err => logger.error(err)) .then(settings => {
return db.fetchOpenTxs(statuses, STALE_LIVE_INCOMING_TX_AGE)
.then(txs => Promise.all(txs.map(r => processTxStatus(settings, r))))
})
.catch(logger.error)
} }
function monitorIncoming () { function monitorIncoming () {
const statuses = ['notSeen', 'published', 'authorized', 'instant', 'rejected', 'insufficientFunds'] const statuses = ['notSeen', 'published', 'authorized', 'instant', 'rejected', 'insufficientFunds']
db.fetchOpenTxs(statuses, STALE_INCOMING_TX_AGE)
.then(txs => Promise.all(txs.map(processTxStatus))) return settingsLoader.settings()
.catch(err => logger.error(err)) .then(settings => {
db.fetchOpenTxs(statuses, STALE_INCOMING_TX_AGE)
.then(txs => Promise.all(txs.map(r => processTxStatus(settings, r))))
})
.catch(logger.error)
} }
function monitorUnnotified () { function monitorUnnotified () {