aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-09-10 13:33:55 -0400
committerAdam Soltys <[email protected]>2022-09-10 13:33:55 -0400
commitf62d5b5c6233510576df0e934d422395b9957833 (patch)
treeb386e9dbbbfd905398b8a38eccc4153df33ca50a /lib
parentfdb1494a717583a2048861b7c4b1cb6b283d0c0c (diff)
downloadcoinos-server-f62d5b5c6233510576df0e934d422395b9957833.tar.gz
coinos-server-f62d5b5c6233510576df0e934d422395b9957833.zip
handle missing pr
Diffstat (limited to 'lib')
-rw-r--r--lib/sync.js6
1 files changed, 2 insertions, 4 deletions
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({