aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sync.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sync.js b/lib/sync.js
index eeff7362..df7c812f 100644
--- a/lib/sync.js
+++ b/lib/sync.js
@@ -243,7 +243,9 @@ const sync = async () => {
l("confirming payment", p.id, p.user_id, p.hash, p.address);
await p.save({ transaction });
- await p.invoice.increment({ received: p.amount }, { transaction });
+ if (p.invoice)
+ await p.invoice.increment({ received: p.amount }, { transaction });
+
await p.account.increment({ balance: p.amount }, { transaction });
await p.account.decrement({ pending: p.amount }, { transaction });
});
@@ -251,7 +253,7 @@ const sync = async () => {
emit(p.user.username, "account", p.account);
emit(p.user.username, "payment", p);
} catch (e) {
- err("problem confirming payment", p, e.message, e.stack);
+ err("problem confirming payment", p.id, e.message, e.stack);
}
}