diff options
| author | Adam Soltys <[email protected]> | 2023-12-23 00:26:26 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-12-23 00:26:31 +0000 |
| commit | a89b891a3311104f2cc34d75d97b84774924befa (patch) | |
| tree | db4aa0b3d69d44311eea5ba2f515039aa5e40b9e /lib/payments.js | |
| parent | fbf27aaeb56cabc004c30215832126c98e7e4c6a (diff) | |
| download | coinos-server-a89b891a3311104f2cc34d75d97b84774924befa.tar.gz coinos-server-a89b891a3311104f2cc34d75d97b84774924befa.zip | |
cltv default
Diffstat (limited to 'lib/payments.js')
| -rw-r--r-- | lib/payments.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/payments.js b/lib/payments.js index c76bea70..92cd0760 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -70,7 +70,7 @@ export let debit = async ({ amount || 0, tip || 0, fee || 0, - ourfee || 0, + ourfee || 0 ); if (r !== "ok") fail("Problem debiting account"); @@ -133,7 +133,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { if (Math.abs(invoice.rate / store.rates[invoice.currency] - 1) < 0.01) { rate = equivalentRate; } else { - warn("rate slipped", hash, invoice.rate, equivalentRate); + // warn("rate slipped", hash, invoice.rate, equivalentRate); } let id = v4(); @@ -176,7 +176,9 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { .incrBy(`${balance}:${uid}`, amount) .exec(); - l("received", type, username, amount, tip); + if (!username.startsWith("lightning")) + l(username, "received", type, amount, tip); + emit(uid, "payment", p); notify(user, `Received ${amount} sats`); callWebhook(invoice, p); @@ -187,7 +189,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { sats: "⚡️" + new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format( - p.amount, + p.amount ), link: `${process.env.URL}/payment/${p.id}`, }); @@ -195,12 +197,12 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { mqtt1.publish( username, - `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`, + `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}` ); mqtt2.publish( username, - `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`, + `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}` ); return p; |
