aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-02-10 06:48:41 +0000
committerAdam Soltys <[email protected]>2023-02-10 06:48:41 +0000
commit19bc51216cc870bdd867a2211bcafbe064366a79 (patch)
tree02b5b5a5686b929966c2235d565728c023fb6e2d
parent6a3db2fd1601d62eee10333392e74b48d4b9cb34 (diff)
downloadcoinos-server-19bc51216cc870bdd867a2211bcafbe064366a79.tar.gz
coinos-server-19bc51216cc870bdd867a2211bcafbe064366a79.zip
check for invoice
-rw-r--r--routes/payments.js6
1 files 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,