diff options
Diffstat (limited to 'lib/payments.js')
| -rw-r--r-- | lib/payments.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/payments.js b/lib/payments.js index 8da04b38..550e3791 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -72,7 +72,7 @@ export let debit = async ({ ? Math.round(amount * config.fee) : 0; - let r = await db.debit( + let r = await db.debit( `balance:${uid}`, `credit:${type}:${uid}`, amount || 0, @@ -89,7 +89,7 @@ export let debit = async ({ amount: -amount, fee, hash, - ourfee: r.ourfee, + ourfee: r.ourfee, memo, iid, uid, @@ -188,9 +188,6 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { .incrBy(`${balance}:${uid}`, amount) .exec(); - if (!username.startsWith("lightning")) - l(username, "received", type, amount, tip); - emit(uid, "payment", p); notify(user, `Received ${amount} sats`); callWebhook(invoice, p); @@ -383,7 +380,10 @@ export let build = async ({ amount, address, feeRate }, user) => { let balance = await g(`balance:${user.id}`); if (amount + fee + ourfee > balance) { - if (amount <= fee + ourfee + dust) fail(`insufficient funds ⚡️${balance} of ⚡️${amount + fee + ourfee + dust}`); + if (amount <= fee + ourfee + dust) + fail( + `insufficient funds ⚡️${balance} of ⚡️${amount + fee + ourfee + dust}`, + ); outs = [{ [address]: btc(amount - ourfee) }]; raw = await node.createRawTransaction([], outs, 0, replaceable); @@ -403,7 +403,7 @@ export let build = async ({ amount, address, feeRate }, user) => { let seen; export let catchUp = async () => { try { - if (!seen) seen = await db.sMembers("missing"); + if (!seen) seen = await db.sMembers("missing"); let txns = []; for (let [type, n] of Object.entries({ bitcoin: bc, liquid: lq })) { txns.push( @@ -432,4 +432,3 @@ export let catchUp = async () => { setTimeout(catchUp, 2000); }; - |
