this should fix double notify bug

This commit is contained in:
Josh Harvey 2016-05-10 13:14:22 +03:00
parent adc1a4f353
commit 7f33e87c21
2 changed files with 5 additions and 10 deletions

View file

@ -467,7 +467,7 @@ function processTxStatus (tx) {
} }
function notifyConfirmation (tx) { function notifyConfirmation (tx) {
logger.debug('notifyConfirmation\n%j', tx) logger.debug('notifyConfirmation')
const phone = tx.phone const phone = tx.phone
const rec = { const rec = {
@ -482,7 +482,7 @@ function notifyConfirmation (tx) {
} }
function monitorLiveIncoming () { function monitorLiveIncoming () {
const statuses = ['notSeen', 'published'] const statuses = ['notSeen', 'published', 'insufficientFunds']
db.fetchOpenTxs(statuses, STALE_INCOMING_TX_AGE, function (err, txs) { db.fetchOpenTxs(statuses, STALE_INCOMING_TX_AGE, function (err, txs) {
if (err) return if (err) return
txs.forEach(processTxStatus) txs.forEach(processTxStatus)
@ -490,13 +490,10 @@ function monitorLiveIncoming () {
} }
function monitorIncoming () { function monitorIncoming () {
const statuses = ['notSeen', 'published', 'authorized', 'instant', 'rejected'] const statuses = ['notSeen', 'published', 'authorized', 'instant', 'rejected', 'insufficientFunds']
db.fetchOpenTxs(statuses, STALE_INCOMING_TX_AGE, function (err, txs) { db.fetchOpenTxs(statuses, STALE_INCOMING_TX_AGE, function (err, txs) {
if (err) return if (err) return
const promises = txs.map(tx => processTxStatus(tx)) txs.forEach(processTxStatus)
return Promise.all(promises)
.then(monitorUnnotified)
}) })
} }
@ -555,7 +552,6 @@ function stopTrader (cryptoCode) {
} }
function pollBalance (cryptoCode, cb) { function pollBalance (cryptoCode, cb) {
console.trace('pollBalance')
logger.debug('[%s] collecting balance', cryptoCode) logger.debug('[%s] collecting balance', cryptoCode)
var walletPlugin = walletPlugins[cryptoCode] var walletPlugin = walletPlugins[cryptoCode]

View file

@ -1,7 +1,6 @@
- change satoshis to crypto_atoms in db (ask neal about this) - change satoshis to crypto_atoms in db (ask neal about this)
- on upgrade, make sure we're not sending out lots of notifications - on upgrade, make sure we're not sending out lots of notifications
- fix plugin reloading, in current version (v) and master
- sending two notifications on confirmation - sending two notifications on confirmation
- reproduce by setting db record to uncomfirmed, etc - reproduce by setting db record to unconfirmed, etc
- something is being called twice, especially notifyConfirmation - something is being called twice, especially notifyConfirmation