diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/auth.js | 3 | ||||
| -rw-r--r-- | lib/invoices.js | 4 | ||||
| -rw-r--r-- | lib/payments.js | 15 |
3 files changed, 9 insertions, 13 deletions
diff --git a/lib/auth.js b/lib/auth.js index 1eca2fa5..944cc3b2 100644 --- a/lib/auth.js +++ b/lib/auth.js @@ -22,8 +22,7 @@ export const auth = { }; export const requirePin = async ({ body, user }) => { - if (!user || (user.pin && user.pin !== body.pin)) - fail("Invalid pin"); + if (!user || (user.pin && user.pin !== body.pin)) fail("Invalid pin"); }; export const jwtStrategy = new jwt.Strategy( diff --git a/lib/invoices.js b/lib/invoices.js index 8023bdbb..8ac8a868 100644 --- a/lib/invoices.js +++ b/lib/invoices.js @@ -47,7 +47,7 @@ export let generate = async ({ invoice, user, sender, memo }) => { description: memo || "", expiry: expiry || 60 * 60 * 24 * 30, deschashonly: true, - cltv: 19 + cltv: 19, }); hash = r.bolt11; @@ -84,8 +84,6 @@ export let generate = async ({ invoice, user, sender, memo }) => { webhook, }; - if (!user.username === 'lightningins') l(type, "invoice", user.username, amount); - if (type === "liquid") { let { unconfidential } = await lq.getAddressInfo(hash); await s(`invoice:${unconfidential}`, id); 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); }; - |
