aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/sync.js6
-rw-r--r--routes/lightning/receive.js2
-rw-r--r--routes/lnurl.js4
3 files changed, 7 insertions, 5 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({
diff --git a/routes/lightning/receive.js b/routes/lightning/receive.js
index 3ecc4ce9..0e241dbd 100644
--- a/routes/lightning/receive.js
+++ b/routes/lightning/receive.js
@@ -12,7 +12,7 @@ import { l, err, warn } from "$lib/logging";
const handlePayment = async msg => {
try {
- l("incoming lightning payment", msg.received, msg.request.substr(0,20));
+ l("incoming lightning payment", msg.received);
if (!msg.secret) return;
let account, total, user;
diff --git a/routes/lnurl.js b/routes/lnurl.js
index a0d2a6d0..6eab008a 100644
--- a/routes/lnurl.js
+++ b/routes/lnurl.js
@@ -22,6 +22,8 @@ import {
conversionFeeReceiver
} from "./lightning/conversionFee.js";
+import send from "$lib/send";
+
const logins = persist("data/logins.json");
const recipients = persist("data/recipients.json");
const lnurlPayments = persist("data/payments.json");
@@ -196,6 +198,7 @@ app.post("/pay", auth, async (req, res, next) => {
if (recipients[secret]) {
url = `${req.protocol}://${req.get("host")}/api/send`;
+ console.log(url);
const { data } = await axios.post(
url,
{
@@ -216,6 +219,7 @@ app.post("/pay", auth, async (req, res, next) => {
res.send(await send(amount, "", data.pr, user));
}
} catch (e) {
+ console.log(e);
err("failed to send payment", e.message);
res.code(500).send(e.message);
}