From 19bc51216cc870bdd867a2211bcafbe064366a79 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 10 Feb 2023 06:48:41 +0000 Subject: check for invoice --- routes/payments.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routes/payments.js b/routes/payments.js index 02620ed4..0ee2bce0 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -40,9 +40,11 @@ export default { if (msatoshi) amount = Math.round(msatoshi / 1000); let invoice = await g(`invoice:${payment_hash}`); - if (invoice.uid === user.id) fail("Cannot send to self"); + if (invoice) { + if (invoice.uid === user.id) fail("Cannot send to self"); + hash = payment_hash; + } - if (invoice) hash = payment_hash; else { p = await debit( hash, -- cgit v1.2.3