From 2b7679cb963f42c10b97b48e794fd8594607e04f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 5 Aug 2021 15:16:26 -0700 Subject: prettier --- routes/lightning/receive.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/routes/lightning/receive.js b/routes/lightning/receive.js index 8d1e8917..d974860e 100644 --- a/routes/lightning/receive.js +++ b/routes/lightning/receive.js @@ -1,19 +1,18 @@ -const handlePayment = async msg => { +const handlePayment = async (msg) => { if (!msg.settled) return; let account, total, user; const invoice = await db.Invoice.findOne({ where: { - text: msg.payment_request - } + text: msg.payment_request, + }, }); if (!invoice) return l.warn("received lightning with no invoice", msg.payment_request); try { - await db.transaction(async transaction => { - + await db.transaction(async (transaction) => { const { text: hash, currency, memo, rate, tip, user_id } = invoice; const amount = parseInt(msg.amt_paid_sat) - tip; if (amount > 10000000 || amount < 0) @@ -23,14 +22,14 @@ const handlePayment = async msg => { where: { user_id, asset: config.liquid.btcasset, - pubkey: null + pubkey: null, }, include: { model: db.User, - as: "user" + as: "user", }, lock: transaction.LOCK.UPDATE, - transaction + transaction, }); ({ user } = account); @@ -51,7 +50,7 @@ const handlePayment = async msg => { confirmed: true, network: "lightning", tip, - invoice_id: invoice.id + invoice_id: invoice.id, }, { transaction } ); @@ -98,7 +97,7 @@ const handlePayment = async msg => { address: c.address, amount: total - 100, user, - limit: total + limit: total, }); } catch (e) { l.error("problem sending liquid payment", e.message, e.stack); @@ -110,14 +109,14 @@ const handlePayment = async msg => { }; if (config.lna.clightning) { - const poll = async ln => { - const wait = async i => { + const poll = async (ln) => { + const wait = async (i) => { const { bolt11: payment_request, pay_index, status, msatoshi_received, - payment_preimage: r_preimage + payment_preimage: r_preimage, } = await ln.waitanyinvoice(i); let settled = status === "paid"; @@ -127,13 +126,13 @@ if (config.lna.clightning) { payment_request, settled, amt_paid_sat, - r_preimage + r_preimage, }); wait(pay_index); }; const { invoices } = await ln.listinvoices(); - wait(Math.max(...invoices.map(i => i.pay_index).filter(n => n))); + wait(Math.max(...invoices.map((i) => i.pay_index).filter((n) => n))); }; poll(lna); -- cgit v1.2.3