diff options
| author | Adam Soltys <[email protected]> | 2020-06-13 21:39:22 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-06-13 21:39:22 -0700 |
| commit | 74b7d2a0d614f170ba5aea3a1a172a7a68356d80 (patch) | |
| tree | be2a73a9917616c0b49c24dc99642378e5a47549 /routes/bitcoin | |
| parent | dcb21adb40a44c8108f1d652cc6ddd59ae7c4024 (diff) | |
| download | coinos-server-74b7d2a0d614f170ba5aea3a1a172a7a68356d80.tar.gz coinos-server-74b7d2a0d614f170ba5aea3a1a172a7a68356d80.zip | |
push notifications
Diffstat (limited to 'routes/bitcoin')
| -rw-r--r-- | routes/bitcoin/receive.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js index 6928dd5c..0593584e 100644 --- a/routes/bitcoin/receive.js +++ b/routes/bitcoin/receive.js @@ -106,7 +106,8 @@ zmqRawTx.on("message", async (topic, message, sequence) => { emit(user.username, "account", account); emit(user.username, "payment", payment); - l.info("bitcoin detected", user.username, o.value); + l.info("bitcoin detected", user.username, value); + notify(user, `${value} SAT payment detected`); } }) ); @@ -149,9 +150,11 @@ setInterval(async () => { const { user } = p; if (p) { + let total = p.amount + p.tip; + p.confirmed = 1; - p.account.balance += p.amount + p.tip; - p.account.pending -= Math.min(p.account.pending, p.amount + p.tip); + p.account.balance += total; + p.account.pending -= Math.min(p.account.pending, total); await p.account.save(); await p.save(); @@ -159,6 +162,7 @@ setInterval(async () => { emit(user.username, "account", p.account); emit(user.username, "payment", p); l.info("bitcoin confirmed", user.username, p.amount, p.tip); + notify(user, `${total} SAT payment confirmed`); } else { l.warn("couldn't find payment", hash); } |
