diff options
Diffstat (limited to 'lib/lightning.js')
| -rw-r--r-- | lib/lightning.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/lightning.js b/lib/lightning.js index c9b41533..7ef62cc9 100644 --- a/lib/lightning.js +++ b/lib/lightning.js @@ -15,7 +15,7 @@ export async function listenForLightning() { pay_index, status, msatoshi_received, - payment_preimage: preimage, + payment_preimage: preimage } = event; await s("pay_index", pay_index); @@ -31,6 +31,9 @@ export async function listenForLightning() { let invoice = await g(`invoice:${hash}`); if (!invoice) return warn("received lightning with no invoice", bolt11); + let payment = await g(`payment:${hash}`); + if (payment) return warn("already processed", hash); + await credit(hash, received, invoice.memo, preimage, types.lightning); } catch (e) { console.log(e); |
