From f62d5b5c6233510576df0e934d422395b9957833 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 10 Sep 2022 13:33:55 -0400 Subject: handle missing pr --- lib/sync.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sync.js b/lib/sync.js index 62d13b24..467ce107 100644 --- a/lib/sync.js +++ b/lib/sync.js @@ -76,8 +76,6 @@ const sync = async () => { }); let { invoices } = await getInvoices({ lnd, limit: 1000 }); - let x = invoices.find(i => i.request.includes('lnbc10100u1p333l3lpp5znwsrpr9g')); - let cancelled = invoices.filter(i => i.is_canceled); let recent = invoices .filter( @@ -88,7 +86,7 @@ const sync = async () => { .map(i => ({ amount: parseInt(i.received), preimage: i.secret, - pr: i.request.toString("hex"), + pr: i.request, createdAt: new Date(i.created_at) })); @@ -103,7 +101,7 @@ const sync = async () => { let missed = recent.filter(i => !settled.includes(i.preimage)); for (let i = 0; i < missed.length; i++) { let { amount, preimage, pr: text, createdAt } = missed[i]; - if (!text.length) continue; + if (!text || !text.length) continue; try { let invoice = await db.Invoice.findOne({ -- cgit v1.2.3