From 2ff6a289f142636beee1846132049cae7cfd82ea Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 31 Oct 2024 09:03:23 -0700 Subject: detect internal payments --- lib/payments.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/payments.ts') diff --git a/lib/payments.ts b/lib/payments.ts index 88b9230d..98c4bc50 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -65,6 +65,9 @@ export const debit = async ({ let iid; if (invoice) { + console.log("AMT", amount); + console.log("RCVD", invoice.received); + console.log(invoice.received >= amount); if (invoice.received >= amount) fail("Invoice already paid"); ({ id: iid } = invoice); @@ -436,7 +439,8 @@ export const sendLightning = async ({ if (typeof amount !== "undefined") { amount = parseInt(amount); - if (amount < 0 || amount > SATS || isNaN(amount)) fail("Invalid amount"); + if (amount < 0 || amount > SATS || Number.isNaN(amount)) + fail("Invalid amount"); } let total = amount; -- cgit v1.2.3