From 7f33e87c2124a72e8b18adc4413b1f59d3a2c8a4 Mon Sep 17 00:00:00 2001 From: Josh Harvey Date: Tue, 10 May 2016 13:14:22 +0300 Subject: [PATCH] this should fix double notify bug --- lib/plugins.js | 12 ++++-------- todo.txt | 3 +-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/plugins.js b/lib/plugins.js index b6eded0a..d5c64ee9 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -467,7 +467,7 @@ function processTxStatus (tx) { } function notifyConfirmation (tx) { - logger.debug('notifyConfirmation\n%j', tx) + logger.debug('notifyConfirmation') const phone = tx.phone const rec = { @@ -482,7 +482,7 @@ function notifyConfirmation (tx) { } function monitorLiveIncoming () { - const statuses = ['notSeen', 'published'] + const statuses = ['notSeen', 'published', 'insufficientFunds'] db.fetchOpenTxs(statuses, STALE_INCOMING_TX_AGE, function (err, txs) { if (err) return txs.forEach(processTxStatus) @@ -490,13 +490,10 @@ function monitorLiveIncoming () { } 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) { if (err) return - const promises = txs.map(tx => processTxStatus(tx)) - - return Promise.all(promises) - .then(monitorUnnotified) + txs.forEach(processTxStatus) }) } @@ -555,7 +552,6 @@ function stopTrader (cryptoCode) { } function pollBalance (cryptoCode, cb) { - console.trace('pollBalance') logger.debug('[%s] collecting balance', cryptoCode) var walletPlugin = walletPlugins[cryptoCode] diff --git a/todo.txt b/todo.txt index 163f768a..d75402d0 100644 --- a/todo.txt +++ b/todo.txt @@ -1,7 +1,6 @@ - change satoshis to crypto_atoms in db (ask neal about this) - 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 - - reproduce by setting db record to uncomfirmed, etc + - reproduce by setting db record to unconfirmed, etc - something is being called twice, especially notifyConfirmation