improve incoming tx status updating

This commit is contained in:
Josh Harvey 2016-05-31 19:13:35 +03:00
parent 2dc332cf1a
commit 38e562bdd6
3 changed files with 49 additions and 17 deletions

View file

@ -406,12 +406,7 @@ function processTxStatus (tx) {
return resolve() // Resolve on error because we ignore errors
}
var status = res.status
if (tx.status === status) return resolve()
const confirm = (status === 'instant' && tx.status !== 'confirmed') ||
(status === 'confirmed' && tx.status !== 'instant')
db.updateTxStatus(tx, status, confirm).then(resolve).catch(reject)
db.updateTxStatus(tx, res.status).then(resolve).catch(reject)
})
})
}