From 053db6c4d155b42bfdd5bb27530ec27dd4421e26 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 22 Dec 2024 23:36:54 -0800 Subject: check for duplicate offers --- lib/invoices.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/invoices.ts b/lib/invoices.ts index f89266e2..0957231a 100644 --- a/lib/invoices.ts +++ b/lib/invoices.ts @@ -90,9 +90,11 @@ export const generate = async ({ invoice, user }) => { const r = await ln.offer({ amount: amount ? `${amount + tip}sat` : "any", label: id, - description: id, + description: memo || id, }); + if (await g(`invoice:${r.offer_id}`)) fail("Duplicate offer exists"); + hash = r.bolt12; text = r.bolt12; -- cgit v1.2.3