diff options
| author | Adam Soltys <[email protected]> | 2023-02-10 06:48:41 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-02-10 06:48:41 +0000 |
| commit | 19bc51216cc870bdd867a2211bcafbe064366a79 (patch) | |
| tree | 02b5b5a5686b929966c2235d565728c023fb6e2d | |
| parent | 6a3db2fd1601d62eee10333392e74b48d4b9cb34 (diff) | |
| download | coinos-server-19bc51216cc870bdd867a2211bcafbe064366a79.tar.gz coinos-server-19bc51216cc870bdd867a2211bcafbe064366a79.zip | |
check for invoice
| -rw-r--r-- | routes/payments.js | 6 |
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, |
