From 2e28b65fc3d790d9fece0f3aa22f35b2012d9739 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 17 Jan 2025 08:50:11 -0800 Subject: allow mint self-payments --- routes/invoices.ts | 1 - routes/payments.ts | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/routes/invoices.ts b/routes/invoices.ts index 6f24e990..79f7b8f1 100644 --- a/routes/invoices.ts +++ b/routes/invoices.ts @@ -31,7 +31,6 @@ export default { try { res.send(await generate({ invoice, user })); } catch (e) { - console.log(e); err("problem generating invoice", e.message); bail(res, e.message); } diff --git a/routes/payments.ts b/routes/payments.ts index 3e59fb0f..ed533c76 100644 --- a/routes/payments.ts +++ b/routes/payments.ts @@ -56,9 +56,8 @@ export default { let p; if (payreq) { - const iid = await g(`invoice:${payreq}`); - if (iid) { - const invoice = await g(`invoice:${iid}`); + const invoice = await getInvoice(payreq); + if (invoice && invoice.uid !== (await g("user:mint"))) { if (invoice.aid === user.id) fail("Cannot send to self"); hash = payreq; if (!amount) ({ amount } = invoice); -- cgit v1.2.3